Class TreeContext


  • @SupportedAll
    public final class TreeContext
    extends Object
    A representation of the context of the current tree authentication process.
    • Field Detail

      • IDM_IDENTITY_RESOURCE

        public static final String IDM_IDENTITY_RESOURCE
        The tree config key for the storage of the IDM identity resource.
        See Also:
        Constant Field Values
      • DEFAULT_IDM_IDENTITY_RESOURCE

        public static final String DEFAULT_IDM_IDENTITY_RESOURCE
        The default IDM identity resource.
        See Also:
        Constant Field Values
      • sharedState

        public final JsonValue sharedState
        The shared state that has accumulated so far by traversing the tree.
      • request

        public final ExternalRequestContext request
        The HTTP request associated with the current authentication request.
      • transientState

        public final JsonValue transientState
        The state that is transient and that won't be stored across requests.
      • universalId

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

        public final String identityResource
        The IDM identity resource container for all IDM object interactions in this tree.
    • Constructor Detail

      • 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 Detail

      • getCallback

        public <T extends CallbackOptional<T> getCallback​(Class<T> callbackType)
        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

        public <T extends CallbackList<T> getCallbacks​(Class<T> callbackType)
        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

        public List<? extends Callback> 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.
      • getState

        public JsonValue getState​(String stateKey)
        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

        public JsonValue getSecureState​(String stateKey)
        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

        public JsonValue getTransientState​(String stateKey)
        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

        public TreeContext copyWithCallbacks​(List<? extends Callback> callbacks)
        Copies this TreeContext instance, replacing the callbacks in the context with the provided callbacks.
        Parameters:
        callbacks - The new callbacks.
        Returns:
        A new TreeContext instance.