Class TreeState

java.lang.Object
org.forgerock.am.trees.model.TreeState

public final class TreeState extends Object
An immutable container for the state associated with a partially or completely evaluated tree.
  • Field Details

    • sharedState

      public final JsonValue sharedState
      The state populated by the nodes in the tree.
    • transientState

      public final JsonValue transientState
      The transient state populated by the nodes in the tree. The values stored in this state is request scoped would not be shared across multiple requests/callbacks in an authentication tree flow. Every time a callback is sent to the user the transient state would be reset to an empty json value object. As data may be promoted to secureState from transientState, transientState should not be accessed directly, but rather via the TreeContext.getState(String) method.
    • currentNodeId

      public final UUID currentNodeId
      The ID of the most recently processed node.
    • sessionProperties

      public final SessionProperties sessionProperties
      Properties that will be included in the user's session if/when it is created.
    • sessionHooks

      public final List<JsonValue> sessionHooks
      List of classes that are run after successful authentication.
    • webhooks

      public final List<String> webhooks
      List of webhooks that are run after session logout.
    • universalId

      public final Optional<String> universalId
      The identity objects universal id.
    • identifiedIdentity

      public final Optional<IdentifiedIdentity> identifiedIdentity
      The identified users.
    • maxTreeDuration

      public final Optional<Duration> maxTreeDuration
      The maximum duration of the tree.
  • Method Details

    • toJson

      public JsonValue toJson()
      Returns the JsonValue format of the TreeState object.
      Returns:
      JsonValue object of TreeState.
    • fromJson

      public static TreeState fromJson(JsonValue json, long maxSessionTime)
      Returns a TreeState object from the JsonValue.
      Parameters:
      json - Json representation of the TreeState object.
      maxSessionTime - the maximum session time.
      Returns:
      TreeState object
    • createInitial

      public static TreeState createInitial(Realm realm, Integer targetAuthLevel, Map<String,Object> initialData, int maxTreeDuration)
      Creates a tree state that represents start of authentication tree.
      Parameters:
      realm - the realm in which the authentication is taking place.
      targetAuthLevel - minimum auth level required for authentication.
      initialData - the initial data passed to the newly created tree.
      maxTreeDuration - the maximum duration of the authentication.
      Returns:
      the initial TreeState
    • secureState

      public JsonValue secureState()
      The secure state populated by transient state which is promoted to be retained across callback boundaries. Values are promoted to secure state from transient state under the condition that we are returning to the user with callbacks, and the key-data in transient state is marked as required by a node further down the tree. Data in secure state is encrypted, and stored within the shared state. As data may be promoted to secureState from transientState, secureState should not be accessed directly, but rather via the TreeContext.getState(String) method.
      Returns:
      The secure state.
    • unencryptedSecureState

      public Optional<JsonValue> unencryptedSecureState()
      The optional unencrypted secure state. This should never be added to the tree result JSON.
      Returns:
      The unencrypted secure state.
    • builder

      public static TreeState.Builder builder()
      Creates a new TreeState builder.
      Returns:
      the builder