|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||
java.lang.Objectorg.exist.security.xacml.RequestHelper
public class RequestHelper
This class provides methods for creating an XACML request. The main methods
are those that return a RequestCtx. Links are provided to the
relevant constants in XACMLConstants to facilitate policy
writing.
XACMLConstants| Method Summary | |
|---|---|
static void |
addSourceAttributes(Set attributes,
XACMLSource source)
Adds new attributes to the specified Set of attributes
that represent the specified source. |
static void |
addStringAttribute(Set attributes,
URI attrID,
String attrValue)
Adds a new attribute of type string to the specified Set of attributes. |
static void |
addURIAttribute(Set attributes,
URI attrID,
String uriString)
Adds a new attribute of type anyURI to the specified Set of attributes. |
Set |
createBasicAction(String action)
Creates the basic attributes needed to describe a simple action in a request. |
Set |
createEnvironment(AccessContext accessCtx)
Creates the environment section of a request for the given AccessContext. |
RequestCtx |
createFunctionRequest(XQueryContext context,
Module contextModule,
QName functionName)
Creates a RequestCtx for a request concerning access
to a function in an XQuery library module. |
Subject |
createModuleSubject(Module module)
Creates a Subject for a Module. |
RequestCtx |
createQueryRequest(XQueryContext context,
XACMLSource source)
Creates an XACML request for permission to execute an XQuery main module. |
Set |
createQueryResource(XACMLSource source)
Creates the Resource section of a request for a main module. |
Set |
createQuerySubjects(User user,
Module contextModule)
Creates Subjects for the specified user and module. |
RequestCtx |
createReflectionRequest(XQueryContext context,
Module contextModule,
String className,
String methodName)
Creates a RequestCtx for a request concerning reflective
access to Java code from an XQuery. |
Set |
createReflectionResource(String className,
String methodName)
Creates a Set of Attributes for a resource
representing Java reflection in an XQuery. |
Subject |
createUserSubject(User user)
Creates a Subject for a User. |
static XACMLSource |
generateModuleSource(Module module)
Generates an XACMLSource for a Module
based on its implementing class name (if it is an
InternalModule) or its Source
(if it is an ExternalModule). |
static String |
getModuleCategory(Module module)
Returns the module type for the given XQuery library module. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public RequestCtx createQueryRequest(XQueryContext context,
XACMLSource source)
execute query. The environment
section will be created by createEnvironment, using the access context
of the query context.
context - The context for this querysource - The source of this query
RequestCtx that may be evaluated by the PDP to
determine whether the specified user may execute the query represented by
source.
public RequestCtx createReflectionRequest(XQueryContext context,
Module contextModule,
String className,
String methodName)
RequestCtx for a request concerning reflective
access to Java code from an XQuery. This handles occurs when a method
is being invoked on the class in question. This method creates a
request with the following content:
createReflectionResource method.createBasicAction method. The action-id is
invoke method.XACMLConstants.ACCESS_CONTEXT_ATTRIBUTE access context
attribute is generated for the environment section.
context - The XQueryContext for the module making the
request.contextModule - The query containing the reflection.className - The name of the class that is being accessed or loaded.methodName - The name of the method that is being invoked
RequestCtx that represents the access in question.
public RequestCtx createFunctionRequest(XQueryContext context,
Module contextModule,
QName functionName)
RequestCtx for a request concerning access
to a function in an XQuery library module. If the function is
from a main module, this method returns null to indicate that.
The client should interpret this to mean that the request is
granted because access to a main module implies access to its
functions.
This method creates a request with the following content:
source-key,
source-type, and
module category
attributes. The functionName parameter is the value of the
subject-id attribute
(the local part) and of the
module namespace
attribute (the namespace URI part). The
resource-category
attribute is function.
createBasicAction method. The action is
call function.
XACMLConstants.ACCESS_CONTEXT_ATTRIBUTE access context
attribute is generated for the environment section.
context - The query context.contextModule - The query making the access.functionName - The QName of the function being called.
RequestCtx that represents the access in question
or null if the function belongs to a main module and
not a library module.public Subject createUserSubject(User user)
Subject for a User.
The user's name is the value of the
subject-id attribute. The
subject-category is access-subject.
The group attribute is a bag
containing the name of each group of which the user is a member.
user - The user making the request
Subject for use in a RequestCtxpublic Set createBasicAction(String action)
action parameter is the value of
the action-id attribute and the
namespace attribute for the
action-id is eXist's XACML
action namespace.
action - The action-id
of the action.
Set that contains attributes describing the
action for use in a RequestCtxpublic Subject createModuleSubject(Module module)
Subject for a Module.
If the module is external, its Source is the value of the
subject-id attribute, otherwise,
the name of the implementing class is used. The subject-category is
codebase. The value of the
module namespace attribute
is the namespace URI of the module. The
module category
attribute is the type of module, either
internal or
external.
module - A query module involved in making the request
Subject for use in a RequestCtx
public Set createReflectionResource(String className,
String methodName)
Set of Attributes for a resource
representing Java reflection in an XQuery.
The resource-category
attribute is method.
The source-type attribute is
class and the
source-key attribute is the
name of the class. The
resource-id attribute is the
method name.
className - The name of the Java classmethodName - The name of the method being invoked
Set containing the Attributes
describing access to Java code by reflection.public Set createQueryResource(XACMLSource source)
source - The source of the query.
Set containing attributes for the specified
query.
public Set createQuerySubjects(User user,
Module contextModule)
Subjects for the specified user and module. This is
equivalent to putting the Subjects created by the
createUserSubject(User user) and
createModuleSubject(Module contextModule) methods. The
context module may be null if there is no context module.
user - The user making the accesscontextModule - The module involved in the access, if any. It may
be null to indicate the is not an intermediary XQuery module.
Set containing a Subject for each
the context module if there is one and the user.public Set createEnvironment(AccessContext accessCtx)
AccessContext.
accessCtx - The context
Set containing one attribute, the
access context
attribute with the value of the specified access context.public static XACMLSource generateModuleSource(Module module)
XACMLSource for a Module
based on its implementing class name (if it is an
InternalModule) or its Source
(if it is an ExternalModule).
module - the module for which the source should be generated
XACMLSource that uniquely defines the source
of the given modulepublic static String getModuleCategory(Module module)
internal or
external
module - The XQuery library module. If it is null, this method
returns null.
public static void addSourceAttributes(Set attributes,
XACMLSource source)
Set of attributes
that represent the specified source. The added attributes are the
source's key and the
source's type.
attributes - The Set to which attributes will be
added. If null, this method does nothing.source - The source for which attributes will be added. It
cannot be null.
public static void addStringAttribute(Set attributes,
URI attrID,
String attrValue)
Set of attributes. The new attribute's value is
constructed from the attrValue parameter and is given the id
of the attrID parameter.
attributes - The Set to which the new attribute
should be added. If it is null, this method does nothing.attrID - The ID of the new attribute, cannot be nullattrValue - The value of the new attribute. It cannot be null.
public static void addURIAttribute(Set attributes,
URI attrID,
String uriString)
throws URISyntaxException
Set of attributes. The new attribute's value is
constructed from the uriString parameter and is given the id
of the attrID parameter.
attributes - The Set to which the new attribute
should be added. If it is null, this method does nothing.attrID - The ID of the new attribute, cannot be nulluriString - The value of the new attribute. It must parse into a
valid URI and cannot be null.
URISyntaxException - if the specified attribute value is not a
valid URI.
|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||