Class PolicyManager

java.lang.Object
org.codice.ddf.security.policy.context.impl.PolicyManager
All Implemented Interfaces:
org.codice.ddf.security.policy.context.ContextPolicyManager

public class PolicyManager extends Object implements org.codice.ddf.security.policy.context.ContextPolicyManager
Implementation of ContextPolicyManager. This implementation starts with a default empty policy at the "/" context and accepts new policies as a Map<String, String> orMap<String, String[]>
  • Constructor Details

    • PolicyManager

      public PolicyManager()
  • Method Details

    • getContextPolicy

      public org.codice.ddf.security.policy.context.ContextPolicy getContextPolicy(String path)
      Specified by:
      getContextPolicy in interface org.codice.ddf.security.policy.context.ContextPolicyManager
    • getAllContextPolicies

      public Collection<org.codice.ddf.security.policy.context.ContextPolicy> getAllContextPolicies()
      Specified by:
      getAllContextPolicies in interface org.codice.ddf.security.policy.context.ContextPolicyManager
    • setContextPolicy

      public void setContextPolicy(String path, org.codice.ddf.security.policy.context.ContextPolicy newContextPolicy)
      Specified by:
      setContextPolicy in interface org.codice.ddf.security.policy.context.ContextPolicyManager
    • setPolicies

      public void setPolicies(Map<String,Object> properties)
      Initializes the policy store. This method will be called every time the policy attributes change. This will happen after the component has been initialized (see configure() and when an update is made to the org.codice.ddf.security.policy.context.impl.PolicyManager configuration pid.
      See https://osgi.org/javadoc/r6/cmpn/org/osgi/service/cm/ManagedService.html for more details on how and when this method may be called.
      Parameters:
      properties - map of properties to use to initialize the policy store. Since there is no configuration file bound to these properties by default, this map may be null.
    • getPolicyStore

      public Map<String,org.codice.ddf.security.policy.context.ContextPolicy> getPolicyStore()
      Returns a duplicate of the current policy store.
      Returns:
      duplicate policy store
    • getWhiteListContexts

      public List<String> getWhiteListContexts()
      Returns a duplicate of the current white list contexts
      Returns:
    • setWhiteListContexts

      public void setWhiteListContexts(List<String> contexts)
    • copyContextPolicy

      public org.codice.ddf.security.policy.context.ContextPolicy copyContextPolicy(org.codice.ddf.security.policy.context.ContextPolicy contextPolicy)
      Duplicates the given context policy
      Parameters:
      contextPolicy -
      Returns:
      copy of contextPolicy
    • getContextAuthTypes

      public List<String> getContextAuthTypes(String path, Map<String,List<String>> contextToAuthTypes)
      Gets the authorization types of the given path. If authorization types of given path do not exist it rolls back until a parent path exists with such authorization types is found If no parent path exists, the authorization types defaults to an empty list
      Parameters:
      path - - Path associated with context
      contextToAuthTypes - - Map of all paths and their context authorization types
      Returns:
      List of authorization types
    • getContextReqAttrs

      public List<org.codice.ddf.security.policy.context.attributes.ContextAttributeMapping> getContextReqAttrs(String path, Map<String,List<org.codice.ddf.security.policy.context.attributes.ContextAttributeMapping>> contextToReqAttrs)
      Gets the required attributes of the context associated to the given path. If required attributes of given path do not exist it rolls back until a parent context path exists with such required attributes is found If no parent path exists, the context defaults to empty list
      Parameters:
      contextToReqAttrs - - Map of all paths to contexts and their associated required attributes
      Returns:
      List of required attributes
    • rollbackPath

      public String rollbackPath(String path)
    • setWebAuthenticationTypes

      public void setWebAuthenticationTypes(String authenticationTypes)
    • setEndpointAuthenticationTypes

      public void setEndpointAuthenticationTypes(String authenticationTypes)
    • setRequiredAttributes

      public void setRequiredAttributes(List<String> requiredAttributes)
    • isWhiteListed

      public boolean isWhiteListed(String contextPath)
      Specified by:
      isWhiteListed in interface org.codice.ddf.security.policy.context.ContextPolicyManager
    • setTraversalDepth

      public void setTraversalDepth(int traversalDepth)
    • setGuestAccess

      public void setGuestAccess(boolean guestAccess)
    • getGuestAccess

      public boolean getGuestAccess()
      Specified by:
      getGuestAccess in interface org.codice.ddf.security.policy.context.ContextPolicyManager
    • setSessionAccess

      public void setSessionAccess(boolean sessionAccess)
    • getSessionAccess

      public boolean getSessionAccess()
      Specified by:
      getSessionAccess in interface org.codice.ddf.security.policy.context.ContextPolicyManager
    • setPolicyFilePath

      public void setPolicyFilePath(String policyFilePath)
    • setSecurityLogger

      public void setSecurityLogger(ddf.security.audit.SecurityLogger securityLogger)
    • configure

      public void configure()
      Called by blueprint once all properties have been initialized. This isn't called by configuration manager - it calls the specified update-method (in this case setPolicies).