org.openliberty.openaz.pep
Class PepRequestFactory

java.lang.Object
  extended by org.openliberty.openaz.pep.PepRequestFactory

public class PepRequestFactory
extends java.lang.Object

The main entry point for building a PEP

The basic pattern is to as follows:

Note: in the method descriptions below, those that are blank generally indicate that the method is primarily used for lower level non-application facing operations.

Author:
Josh Bregman, Rich Levinson, Prateek Mishra

Field Summary
static java.lang.String DEFAULT_PROVIDER_NAME
           
 
Constructor Summary
PepRequestFactory(java.lang.String name, AzService azService)
          Constructor of Pep Request Factory uses the DefaultDecisionHandler
PepRequestFactory(java.lang.String name, AzService azService, java.util.List<PreDecisionHandler> preDecideHandlers, DecisionHandler decideHandler, java.util.List<PostDecisionHandler> postDecideHandlers)
          Constructor that allows for the inclusion of custom PreDecisionHandler, DecisionHandler and PostDecsionHandler
 
Method Summary
 ActionFactory getActionFactory()
           
 java.lang.Object getActionObject(AzResourceActionAssociation azRaa)
           
 AzService getAzService()
           
 DecisionHandler getDecisionHandler()
           
 EnvironmentFactory getEnvironmentFactory()
           
 java.lang.String getName()
           
 java.util.List<PostDecisionHandler> getPostDecisionHandlers()
           
 java.util.List<PreDecisionHandler> getPreDecisionHandlers()
           
 java.lang.String getProviderClassName()
           
 ResourceFactory getResourceFactory()
           
 java.lang.Object getResourceObject(AzResourceActionAssociation azRaa)
           
 java.lang.Object getResourceObjectId(java.lang.Object resourceObject)
           
 PepResponseFactory getResponseFactory()
           
 SubjectFactory getSubjectFactory()
           
 PepRequest newBulkPepRequest(java.lang.Object subjectObj, java.util.List actionObjects, java.util.List resourceObjects, java.lang.Object environmentObj)
          Create a PepRequest using objects, where a list of n action objects and a corresponding list of n resource objects are provided to represent n resource-action pairs.
 PepRequest newBulkPepRequest(java.lang.Object subjectObj, java.util.List actionResourceObjects, java.lang.Object environmentObj)
          Create a PepRequest using objects, where a list of n action-resource objects are provided.
 PepRequest newPepRequest(java.lang.Object subjectObj, java.lang.Object actionResourceObject, java.lang.Object environmentObj)
          Creates a PEP request using objects, but the action and the resource are both derived from the same object ex: Permission or HttpServletRequest
 PepRequest newPepRequest(java.lang.Object subjectObj, java.lang.Object actionObj, java.lang.Object resourceObj, java.lang.Object environmentObj)
          Create a PepRequest using objects
 PepRequest newPepRequest(java.lang.String subjectName, java.lang.String actionId, java.lang.String resourceId)
          Create a PepRequest juts using Strings
 PepRequest newQueryPepRequest(java.lang.Object subjectObj, java.lang.Object environmentObj, java.lang.String scope, PepRequest.QUERY_TYPE queryType)
          Create a PepRequest using subject and environment objects, plus a "scope" String that represents a PDP policy-specific resource representation.
 void setActionFactory(ActionFactory actionFactory)
           
 void setAzService(AzService azService)
           
 void setEnvironmentFactory(EnvironmentFactory environmentFactory)
           
 void setName(java.lang.String name)
           
 void setProviderClassName(java.lang.String providerClassName)
           
 void setResourceFactory(ResourceFactory resourceFactory)
           
 void setResponseFactory(PepResponseFactory responseFactory)
           
 void setSubjectFactory(SubjectFactory subjectFactory)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_PROVIDER_NAME

public static final java.lang.String DEFAULT_PROVIDER_NAME
See Also:
Constant Field Values
Constructor Detail

PepRequestFactory

public PepRequestFactory(java.lang.String name,
                         AzService azService,
                         java.util.List<PreDecisionHandler> preDecideHandlers,
                         DecisionHandler decideHandler,
                         java.util.List<PostDecisionHandler> postDecideHandlers)
Constructor that allows for the inclusion of custom PreDecisionHandler, DecisionHandler and PostDecsionHandler

Parameters:
name - The name of the PEP. This is used as the issuer of all of the attributes.
azService - A handle to the AzService
preDecisionHandlers -
decisionHanlder -
postDecisionHandlers -

PepRequestFactory

public PepRequestFactory(java.lang.String name,
                         AzService azService)
Constructor of Pep Request Factory uses the DefaultDecisionHandler

Parameters:
name - The name of the PEP. This is used as the issuer of all of the attributes.
azService - A handle to the AzService
Method Detail

newPepRequest

public PepRequest newPepRequest(java.lang.String subjectName,
                                java.lang.String actionId,
                                java.lang.String resourceId)
                         throws PepException
Create a PepRequest juts using Strings

Parameters:
subjectName - String representing the name of the subejct ex: Josh
resourceId - String representing the resource ex: file1234
actionId - String representing the action ex: read
Returns:
Throws:
PepException - Indicates that there is some issue creating the PEPRequest

newPepRequest

public PepRequest newPepRequest(java.lang.Object subjectObj,
                                java.lang.Object actionObj,
                                java.lang.Object resourceObj,
                                java.lang.Object environmentObj)
                         throws PepException
Create a PepRequest using objects

Parameters:
subjectObj - Object representing the Subject ex: javax.auth.security.Subject
actionObj - Object representing the Action ex: String (read)
resourceObj - Object representing the Resource ex: String (file) or File
environmentObj - Object representing the Environment ex: Map containing attributes name and values
Returns:
Throws:
PepException - if there is no JavObjectMapper configured for the objects passed into the factory.
See Also:
JavaObjectMapper

newPepRequest

public PepRequest newPepRequest(java.lang.Object subjectObj,
                                java.lang.Object actionResourceObject,
                                java.lang.Object environmentObj)
                         throws PepException
Creates a PEP request using objects, but the action and the resource are both derived from the same object ex: Permission or HttpServletRequest

Parameters:
subjectObj - Object representing the Subject ex: javax.auth.security.Subject
actionResourceObject - Object representing both the action and the resource ex: FilePermission or HttpServletRequest
environmentObj - Object representing the Environment ex: Map containing attributes name and values
Returns:
Throws:
PepException - if there is no JavObjectMapper configured for the objects passed into the factory.
See Also:
JavaObjectMapper

newBulkPepRequest

public PepRequest newBulkPepRequest(java.lang.Object subjectObj,
                                    java.util.List actionObjects,
                                    java.util.List resourceObjects,
                                    java.lang.Object environmentObj)
                             throws PepException
Create a PepRequest using objects, where a list of n action objects and a corresponding list of n resource objects are provided to represent n resource-action pairs. A decision for each resource-action pair will be returned, when PepRequest.decide() is invoked.

Parameters:
subjectObj - Object representing the Subject ex: javax.auth.security.Subject
list - of length n, of actionObj Objects representing the Actions ex: String (read)
list - of length n, of resourceObj Objects representing the Resources ex: String (file) or File
environmentObj - Object representing the Environment ex: Map containing attributes name and values
Returns:
Throws:
PepException

newBulkPepRequest

public PepRequest newBulkPepRequest(java.lang.Object subjectObj,
                                    java.util.List actionResourceObjects,
                                    java.lang.Object environmentObj)
                             throws PepException
Create a PepRequest using objects, where a list of n action-resource objects are provided. A decision for each resource-action pair will be returned, when PepRequest.decide() is invoked.

Parameters:
subjectObj - Object representing the Subject ex: javax.auth.security.Subject
list - of length n, of actionResourceObjects representing the Action Resource pairs ex: String (read), String (file)
environmentObj - Object representing the Environment ex: Map containing attributes name and values
Returns:
Throws:
PepException

newQueryPepRequest

public PepRequest newQueryPepRequest(java.lang.Object subjectObj,
                                     java.lang.Object environmentObj,
                                     java.lang.String scope,
                                     PepRequest.QUERY_TYPE queryType)
                              throws PepException
Create a PepRequest using subject and environment objects, plus a "scope" String that represents a PDP policy-specific resource representation. When the PepRequest.decide() method is invoked, based on queryType it will return either
                - a list of Allowed ResourceAction pairs within scope
                - a list of Denied ResourceAction pairs within scope
                - or a list of full detailed results for all 
                        ResourceAction pairs within scope
 

Parameters:
subjectObj -
environmentObj -
scope - a string containing a PDP policy-specific resource representation
queryType - an enum containing a choice of allowed, denied, or full/verbose
Returns:
Throws:
PepException

setProviderClassName

public void setProviderClassName(java.lang.String providerClassName)

getProviderClassName

public java.lang.String getProviderClassName()

getResourceObjectId

public java.lang.Object getResourceObjectId(java.lang.Object resourceObject)

getResourceObject

public java.lang.Object getResourceObject(AzResourceActionAssociation azRaa)

getActionObject

public java.lang.Object getActionObject(AzResourceActionAssociation azRaa)

setName

public void setName(java.lang.String name)

getName

public java.lang.String getName()

setAzService

public void setAzService(AzService azService)

getAzService

public AzService getAzService()

setEnvironmentFactory

public void setEnvironmentFactory(EnvironmentFactory environmentFactory)

getEnvironmentFactory

public EnvironmentFactory getEnvironmentFactory()

setResourceFactory

public void setResourceFactory(ResourceFactory resourceFactory)

getResourceFactory

public ResourceFactory getResourceFactory()

setSubjectFactory

public void setSubjectFactory(SubjectFactory subjectFactory)

getSubjectFactory

public SubjectFactory getSubjectFactory()

setActionFactory

public void setActionFactory(ActionFactory actionFactory)

getActionFactory

public ActionFactory getActionFactory()

setResponseFactory

public void setResponseFactory(PepResponseFactory responseFactory)

getResponseFactory

public PepResponseFactory getResponseFactory()

getPreDecisionHandlers

public java.util.List<PreDecisionHandler> getPreDecisionHandlers()

getDecisionHandler

public DecisionHandler getDecisionHandler()

getPostDecisionHandlers

public java.util.List<PostDecisionHandler> getPostDecisionHandlers()