com.ibm.sec.authz.jaccplus
Class ContainerEvaluationContext
- java.lang.Object
com.ibm.sec.authz.jaccplus.ContainerEvaluationContext
All implemented interfaces:
- public final class ContainerEvaluationContext
- extends java.lang.Object
An implementation of EvaluationContext
for use when using the authenticated subject from a
a supported container such as WebSphere Application Server. If this implementation is used, then the currently
authenticated user will automatically be serialized as the subject during a call to
ApplicationPolicy.implies(String, EvaluationContext, java.security.Permission)
.
Once created re-use the instance of EvaluationContext for the life of the application and across threads. Potentially expensive initialization is done when this class is constructed.
Constructor Summary
Constructor and Description |
---|
ContainerEvaluationContext()
Constructs a ContainerEvaluationContext instance.
|
Method Summary
Modifier and Type | Method and Description |
---|---|
|
getContext(java.lang.String key)
|
|
getHandlerData()
|
|
getKeys()
|
|
registerHandler(java.lang.String key,IEvaluationContextHandler handler,boolean replace)
|
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail
ContainerEvaluationContext
- public ContainerEvaluationContext( )
- throws PolicyContextException
Constructs a ContainerEvaluationContext instance.
Throws:
PolicyContextException
- if an error occurs while initializing the container-
specific handler code. Method Detail
registerHandler
- public void registerHandler(java.lang.String key,
- IEvaluationContextHandler handler,
- boolean replace)
- throws PolicyContextException
Description copied from interface:
EvaluationContext
This method registers a
PolicyContextHandler
implementation for a particular
key. A single handler implementation can be registered to handle multiple keys.
Specified by:
registerHandler
in interface EvaluationContext
Parameters:
key
- the key. handler
- the policy context handler implementation. replace
- this boolean value defines the behaviour of this method if,
when it is called, a policy context handler implementation
has already been registered to handle the same key.
In that case and if the value of this argument is true,
the existing handler is replaced with the argument handler.
If the value of this parameter is false, the existing registration is
preserved and an exception is thrown. Throws:
PolicyContextException
- if an error occurs. getKeys
- public java.util.Set<java.lang.String> getKeys( )
Description copied from interface:
EvaluationContext
Returns the set of keys that this evaluation context can handle.
Specified by:
getKeys
in interface EvaluationContext
Returns:
the set of keys.
getContext
- public java.lang.Object getContext( java.lang.String key)
- throws PolicyContextException
Description copied from interface:
EvaluationContext
Given a key, returns the corresponding context object.
Specified by:
getContext
in interface EvaluationContext
Parameters:
key
- the key. Returns:
the attribute.
Throws:
PolicyContextException
getHandlerData
- public java.util.Map<java.lang.String,java.lang.Object> getHandlerData( )
Description copied from interface:
EvaluationContext
Gets the thread-scoped handler data object.
Specified by:
getHandlerData
in interface EvaluationContext
Returns:
The thread-local handler data map.