Class NodeState
- java.lang.Object
-
- org.forgerock.openam.auth.node.api.NodeState
-
@SupportedAll public final class NodeState extends Object
Encapsulates all state that is provided by each node and passed between nodes on tree execution.There are three types of state: transient, secure and shared. Shared state is non-sensitive state, secure state is decrypted transient state and transient state is sensitive state that will be encrypted on round trips to the client.
This class encapsulates all three types of state to abstract from where a node's implementation decides to store its state based on each state's properties. Callers to this class should not know or care what type of state a particular piece of state is stored, only that it can be retrieved. This class also exposes the ability for callers to add state to either the shared state (non-sensitive) or transient state (sensitive).
-
-
Field Summary
Fields Modifier and Type Field Description static String
STATE_FILTER_WILDCARD
Wildcard state filter that allows access to all state.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description JsonValue
get(String key)
Gets the value for the given key from the state.boolean
isDefined(String key)
Checks if the given key is defined in any of the types of state.Set<String>
keys()
Gets the distinct keys from across all types of state.NodeState
putShared(String key, Object value)
Puts the given key/value pair in the shared state.NodeState
putTransient(String key, Object value)
Puts the given key/value pair in the transient state.void
remove(String key)
Removes the given key from all states.
-
-
-
Field Detail
-
STATE_FILTER_WILDCARD
public static final String STATE_FILTER_WILDCARD
Wildcard state filter that allows access to all state.- See Also:
- Constant Field Values
-
-
Method Detail
-
get
public JsonValue get(String key)
Gets the value for the given key from the state.The order of state types checked is the following:
- transient
- secure
- shared
- Parameters:
key
- The key.- Returns:
- The value or
null
if the key is not defined.
-
isDefined
public boolean isDefined(String key)
Checks if the given key is defined in any of the types of state.- Parameters:
key
- The key.- Returns:
true
if the key is defined, otherwisefalse
.
-
keys
public Set<String> keys()
Gets the distinct keys from across all types of state.- Returns:
- The set of all keys.
-
putShared
public NodeState putShared(String key, Object value)
Puts the given key/value pair in the shared state.The shared state should only be used for non-sensitive information that will be signed on round trips to the client.
- Parameters:
key
- The key.value
- The value.- Returns:
- This modified
NodeState
instance.
-
putTransient
public NodeState putTransient(String key, Object value)
Puts the given key/value pair in the transient state.The transient state should only be used for sensitive information that will be encrypted on round trips to the client.
- Parameters:
key
- The key.value
- The value.- Returns:
- This modified
NodeState
instance.
-
remove
public void remove(String key)
Removes the given key from all states.- Parameters:
key
- The key to remove.
-
-