Class TreeContext
java.lang.Object
org.forgerock.openam.auth.node.api.TreeContext
A representation of the context of the current tree authentication process.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
The default IDM identity resource.final String
The IDM identity resource container for all IDM object interactions in this tree.static final String
The tree config key for the storage of the IDM identity resource.final ExternalRequestContext
The HTTP request associated with the current authentication request.final JsonValue
Deprecated.final JsonValue
Deprecated.UsegetStateFor(Node)
instead as this method does not leak implementation detail of the specific type of state.The identity objects universal id. -
Constructor Summary
ConstructorDescriptionTreeContext
(String identityResource, JsonValue sharedState, JsonValue transientState, JsonValue secureState, ExternalRequestContext request, List<? extends Callback> callbacks, boolean resumedFromSuspend, Optional<String> universalId) Construct a tree context for the current state.TreeContext
(String identityResource, JsonValue sharedState, JsonValue transientState, JsonValue secureState, ExternalRequestContext request, List<? extends Callback> callbacks, Optional<String> universalId) Construct a tree context for the current state.TreeContext
(String identityResource, JsonValue sharedState, JsonValue transientState, ExternalRequestContext request, List<? extends Callback> callbacks, Optional<String> universalId) Construct a tree context for the current state.TreeContext
(String identityResource, JsonValue sharedState, ExternalRequestContext request, List<? extends Callback> callbacks) Construct a tree context for the current state.TreeContext
(JsonValue sharedState, JsonValue transientState, JsonValue secureState, ExternalRequestContext request, List<? extends Callback> callbacks, boolean resumedFromSuspend, Optional<String> universalId) Construct a tree context for the current state.TreeContext
(JsonValue sharedState, JsonValue transientState, JsonValue secureState, ExternalRequestContext request, List<? extends Callback> callbacks, Optional<String> universalId) Construct a tree context for the current state.TreeContext
(JsonValue sharedState, JsonValue transientState, ExternalRequestContext request, List<? extends Callback> callbacks, Optional<String> universalId) Construct a tree context for the current state.TreeContext
(JsonValue sharedState, ExternalRequestContext request, List<? extends Callback> callbacks, Optional<String> universalId) Construct a tree context for the current state. -
Method Summary
Modifier and TypeMethodDescriptioncopyWithCallbacks
(List<? extends Callback> callbacks) Copies this TreeContext instance, replacing the callbacks in the context with the provided callbacks.copyWithCallbacksAndState
(JsonValue sharedState, JsonValue transientState, JsonValue secureState, List<? extends Callback> callbacks) Copies this TreeContext instance, replacing the callbacks in the context with the provided callbacks and with the provided new state if input state parameter is not null.Gets all the callbacks sent in the request.getCallback
(Class<T> callbackType) Get the first callback of a particular type from the callbacks in the context.getCallbacks
(Class<T> callbackType) Get the callbacks of a particular type from the callbacks in the context.getSecureState
(String stateKey) Deprecated.UsegetStateFor(Node)
instead as this method does not leak implementation detail of the specific type of state.Deprecated.UsegetStateFor(Node)
instead as this method performs the same function but supports filtering of the available state based on the nodes declared inputs.getStateFor
(Node node) Returns a new instance ofNodeState
encapsulating all types of state and allowing access to state in the following order.getTransientState
(String stateKey) Deprecated.UsegetStateFor(Node)
instead as this method does not leak implementation detail of the specific type of state.boolean
Check if any callbacks have been submitted in this authenticate request.boolean
Whether the tree has been resumed from having been suspended.
-
Field Details
-
IDM_IDENTITY_RESOURCE
The tree config key for the storage of the IDM identity resource.- See Also:
-
DEFAULT_IDM_IDENTITY_RESOURCE
The default IDM identity resource.- See Also:
-
request
The HTTP request associated with the current authentication request. -
transientState
Deprecated.UsegetStateFor(Node)
instead as this method does not leak implementation detail of the specific type of state.The state that is transient and is encrypted and stored across requests only if downstream nodes declare they use it. -
universalId
The identity objects universal id. -
identityResource
The IDM identity resource container for all IDM object interactions in this tree.
-
-
Constructor Details
-
TreeContext
public TreeContext(String identityResource, JsonValue sharedState, ExternalRequestContext request, List<? extends Callback> callbacks) Construct a tree context for the current state.- Parameters:
identityResource
- The IDM identity resource.sharedState
- The shared state.request
- The request associated with the current authentication request.callbacks
- The callbacks received in the current authentication request.
-
TreeContext
public TreeContext(JsonValue sharedState, ExternalRequestContext request, List<? extends Callback> callbacks, Optional<String> universalId) Construct a tree context for the current state.- Parameters:
sharedState
- The shared state.request
- The request associated with the current authentication request.callbacks
- The callbacks received in the current authentication request.universalId
- The universal id of the identity object.
-
TreeContext
public TreeContext(String identityResource, JsonValue sharedState, JsonValue transientState, ExternalRequestContext request, List<? extends Callback> callbacks, Optional<String> universalId) Construct a tree context for the current state.- Parameters:
identityResource
- The IDM identity resource.sharedState
- The shared state.transientState
- The transient state.request
- The request associated with the current authentication request.callbacks
- The callbacks received in the current authentication request.universalId
- The universal id of the identity object.
-
TreeContext
public TreeContext(JsonValue sharedState, JsonValue transientState, ExternalRequestContext request, List<? extends Callback> callbacks, Optional<String> universalId) Construct a tree context for the current state.- Parameters:
sharedState
- The shared state.transientState
- The transient state.request
- The request associated with the current authentication request.callbacks
- The callbacks received in the current authentication request.universalId
- The universal id of the identity object.
-
TreeContext
public TreeContext(String identityResource, JsonValue sharedState, JsonValue transientState, JsonValue secureState, ExternalRequestContext request, List<? extends Callback> callbacks, Optional<String> universalId) Construct a tree context for the current state.- Parameters:
identityResource
- The IDM identity resource.sharedState
- The shared state.transientState
- The transient state.secureState
- The secure state.request
- The request associated with the current authentication request.callbacks
- The callbacks received in the current authentication request.universalId
- The universal id of the identity object.
-
TreeContext
public TreeContext(JsonValue sharedState, JsonValue transientState, JsonValue secureState, ExternalRequestContext request, List<? extends Callback> callbacks, Optional<String> universalId) Construct a tree context for the current state.- Parameters:
sharedState
- The shared state.transientState
- The transient state.secureState
- The secure state.request
- The request associated with the current authentication request.callbacks
- The callbacks received in the current authentication request.universalId
- The universal id of the identity object.
-
TreeContext
public TreeContext(String identityResource, JsonValue sharedState, JsonValue transientState, JsonValue secureState, ExternalRequestContext request, List<? extends Callback> callbacks, boolean resumedFromSuspend, Optional<String> universalId) Construct a tree context for the current state.- Parameters:
identityResource
- The IDM identity resource.sharedState
- The shared state.transientState
- The transient state.secureState
- The secure state.request
- The request associated with the current authentication request.callbacks
- The callbacks received in the current authentication request.resumedFromSuspend
- whether the tree has been resumed from having been suspended.universalId
- The universal id of the identity object.
-
TreeContext
public TreeContext(JsonValue sharedState, JsonValue transientState, JsonValue secureState, ExternalRequestContext request, List<? extends Callback> callbacks, boolean resumedFromSuspend, Optional<String> universalId) Construct a tree context for the current state.- Parameters:
sharedState
- The shared state.transientState
- The transient state.secureState
- The secure state.request
- The request associated with the current authentication request.callbacks
- The callbacks received in the current authentication request.resumedFromSuspend
- whether the tree has been resumed from having been suspended.universalId
- The universal id of the identity object.
-
-
Method Details
-
getCallback
Get the first callback of a particular type from the callbacks in the context.- Type Parameters:
T
- The generic type of the callback.- Parameters:
callbackType
- The type of callback.- Returns:
- An optional of the callback or empty if no callback of that type existed.
-
getCallbacks
Get the callbacks of a particular type from the callbacks in the context.- Type Parameters:
T
- The generic type of the callback.- Parameters:
callbackType
- The type of callback.- Returns:
- An list of callbacks or empty if no callback of that type existed.
-
getAllCallbacks
Gets all the callbacks sent in the request.Use
getCallback(Class)
in preference to this method.- Returns:
- An unmodifiable list of callbacks.
-
hasCallbacks
public boolean hasCallbacks()Check if any callbacks have been submitted in this authenticate request.- Returns:
true
if there are callbacks available.
-
getStateFor
Returns a new instance ofNodeState
encapsulating all types of state and allowing access to state in the following order.- transient
- secure
- shared
- Parameters:
node
- The node whose state is being requested.- Returns:
- The unified
NodeState
.
-
getState
Deprecated.UsegetStateFor(Node)
instead as this method performs the same function but supports filtering of the available state based on the nodes declared inputs.Retrieves a field from one of the three supported state locations, or null if the key is not found in any of the state locations.- Parameters:
stateKey
- The key to look for.- Returns:
- The first occurrence of the key from the states, in order: Transient, Secure, Shared.
-
getSecureState
Deprecated.UsegetStateFor(Node)
instead as this method does not leak implementation detail of the specific type of state.Retrieves a field from one the secure state, or null if the key is not found.- Parameters:
stateKey
- The key to look for.- Returns:
- The key value from secure state if present.
-
getTransientState
Deprecated.UsegetStateFor(Node)
instead as this method does not leak implementation detail of the specific type of state.Retrieves a field from either transient or secured state, or null if the key is not found in any of the state locations.- Parameters:
stateKey
- The key to look for.- Returns:
- The first occurrence of the key from the states, in order: Secure, Transient.
-
hasResumedFromSuspend
public boolean hasResumedFromSuspend()Whether the tree has been resumed from having been suspended.- Returns:
- whether the tree has been resumed from having been suspended
-
copyWithCallbacks
Copies this TreeContext instance, replacing the callbacks in the context with the provided callbacks.- Parameters:
callbacks
- The new callbacks.- Returns:
- A new TreeContext instance.
-
copyWithCallbacksAndState
public TreeContext copyWithCallbacksAndState(JsonValue sharedState, JsonValue transientState, JsonValue secureState, List<? extends Callback> callbacks) Copies this TreeContext instance, replacing the callbacks in the context with the provided callbacks and with the provided new state if input state parameter is not null.- Parameters:
sharedState
- The new sharedState, if null use previous value.transientState
- The new transientState, if null use previous value.secureState
- The new secureState, if null use previous value.callbacks
- The new callbacks.- Returns:
- A new TreeContext instance.
-
getStateFor(Node)
instead as this method does not leak implementation detail of the specific type of state.