Class PolicyRestrictor

java.lang.Object
org.jolokia.server.core.restrictor.policy.PolicyRestrictor
All Implemented Interfaces:
Restrictor

public class PolicyRestrictor extends Object implements Restrictor
Restrictor, which is based on a policy file
Since:
Jul 28, 2009
Author:
roland
  • Constructor Details

    • PolicyRestrictor

      public PolicyRestrictor(InputStream pInput)
      Construct a policy restrictor from an input stream
      Parameters:
      pInput - stream from where to fetch the policy data
  • Method Details

    • isHttpMethodAllowed

      public boolean isHttpMethodAllowed(HttpMethod method)
      Check whether the HTTP method with which the request was sent is allowed.
      Specified by:
      isHttpMethodAllowed in interface Restrictor
      Parameters:
      method - method to check
      Returns:
      true if there is no restriction on the method with which the request was sent, false otherwise
    • isTypeAllowed

      public boolean isTypeAllowed(RequestType pType)
      Check whether the provided command type is allowed in principal
      Specified by:
      isTypeAllowed in interface Restrictor
      Parameters:
      pType - type to check
      Returns:
      true, if the type is allowed, false otherwise
    • isRemoteAccessAllowed

      public boolean isRemoteAccessAllowed(String... pHostOrAddress)
      Check whether access from the connected client is allowed. If at least one of the given parameters matches, then this method returns true.
      Specified by:
      isRemoteAccessAllowed in interface Restrictor
      Parameters:
      pHostOrAddress - one or more host or address names.
      Returns:
      true is access is allowed
    • isOriginAllowed

      public boolean isOriginAllowed(String pOrigin, boolean pOnlyWhenStrictCheckingIsEnabled)
      Check whether cross browser access via CORS is allowed. See the CORS specification for details
      Specified by:
      isOriginAllowed in interface Restrictor
      Parameters:
      pOrigin - the "Origin:" header provided within the request
      pOnlyWhenStrictCheckingIsEnabled - whether by-pass check when strict checking is disabled
      Returns:
      true if this cross browser request allowed, false otherwise
    • isAttributeReadAllowed

      public boolean isAttributeReadAllowed(ObjectName pName, String pAttribute)
      Check whether reading of an attribute is allowed
      Specified by:
      isAttributeReadAllowed in interface Restrictor
      Parameters:
      pName - MBean name
      pAttribute - attribute to check
      Returns:
      true if access is allowed
    • isAttributeWriteAllowed

      public boolean isAttributeWriteAllowed(ObjectName pName, String pAttribute)
      Check whether writing of an attribute is allowed
      Specified by:
      isAttributeWriteAllowed in interface Restrictor
      Parameters:
      pName - MBean name
      pAttribute - attribute to check
      Returns:
      true if access is allowed
    • isOperationAllowed

      public boolean isOperationAllowed(ObjectName pName, String pOperation)
      Check whether execution of an operation is allowed
      Specified by:
      isOperationAllowed in interface Restrictor
      Parameters:
      pName - MBean name
      pOperation - attribute to check
      Returns:
      true if access is allowed