|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.exist.security.xacml.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(java.util.Set attributes,
XACMLSource source)
Adds new attributes to the specified Set of attributes
that represent the specified source. |
static void |
addStringAttribute(java.util.Set attributes,
java.net.URI attrID,
java.lang.String attrValue)
Adds a new attribute of type string to the specified Set of attributes. |
static void |
addURIAttribute(java.util.Set attributes,
java.net.URI attrID,
java.lang.String uriString)
Adds a new attribute of type anyURI to the specified Set of attributes. |
java.util.Set |
createBasicAction(java.lang.String action)
Creates the basic attributes needed to describe a simple action in a request. |
java.util.Set |
createEnvironment(AccessContext accessCtx)
Creates the environment section of a request for the given AccessContext . |
com.sun.xacml.ctx.RequestCtx |
createFunctionRequest(XQueryContext context,
Module contextModule,
QName functionName)
Creates a RequestCtx for a request concerning access
to a function in an XQuery library module. |
com.sun.xacml.ctx.Subject |
createModuleSubject(Module module)
Creates a Subject for a Module . |
com.sun.xacml.ctx.RequestCtx |
createQueryRequest(XQueryContext context,
XACMLSource source)
Creates an XACML request for permission to execute an XQuery main module. |
java.util.Set |
createQueryResource(XACMLSource source)
Creates the Resource section of a request for a main module. |
java.util.Set |
createQuerySubjects(User user,
Module contextModule)
Creates Subject s for the specified user and module. |
com.sun.xacml.ctx.RequestCtx |
createReflectionRequest(XQueryContext context,
Module contextModule,
java.lang.String className,
java.lang.String methodName)
Creates a RequestCtx for a request concerning reflective
access to Java code from an XQuery. |
java.util.Set |
createReflectionResource(java.lang.String className,
java.lang.String methodName)
Creates a Set of Attribute s for a resource
representing Java reflection in an XQuery. |
com.sun.xacml.ctx.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 java.lang.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 com.sun.xacml.ctx.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 com.sun.xacml.ctx.RequestCtx createReflectionRequest(XQueryContext context, Module contextModule, java.lang.String className, java.lang.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 com.sun.xacml.ctx.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 com.sun.xacml.ctx.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 RequestCtx
public java.util.Set createBasicAction(java.lang.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 RequestCtx
public com.sun.xacml.ctx.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 java.util.Set createReflectionResource(java.lang.String className, java.lang.String methodName)
Set
of Attribute
s 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 Attribute
s
describing access to Java code by reflection.public java.util.Set createQueryResource(XACMLSource source)
source
- The source of the query.
Set
containing attributes for the specified
query.public java.util.Set createQuerySubjects(User user, Module contextModule)
Subject
s for the specified user and module. This is
equivalent to putting the Subject
s 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 java.util.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 java.lang.String getModuleCategory(Module module)
internal
or
external
module
- The XQuery library module. If it is null, this method
returns null.
public static void addSourceAttributes(java.util.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(java.util.Set attributes, java.net.URI attrID, java.lang.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(java.util.Set attributes, java.net.URI attrID, java.lang.String uriString) throws java.net.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.
java.net.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 |