Class Action.ActionBuilder

java.lang.Object
org.forgerock.openam.auth.node.api.Action.ActionBuilder
Enclosing class:
Action

public static final class Action.ActionBuilder extends Object
Builder for the Action.
  • Method Details

    • replaceSharedState

      public Action.ActionBuilder replaceSharedState(JsonValue sharedState)
      Replace the shared state.
      Parameters:
      sharedState - the new state.
      Returns:
      the same instance of the ActionBuilder.
    • replaceTransientState

      public Action.ActionBuilder replaceTransientState(JsonValue transientState)
      Replace the transient state.
      Parameters:
      transientState - the new transient state.
      Returns:
      the same instance of the ActionBuilder.
    • withHeader

      public Action.ActionBuilder withHeader(String header)
      Set a header for this action.
      Parameters:
      header - the header for the action.
      Returns:
      the same instance of the ActionBuilder.
    • withDescription

      public Action.ActionBuilder withDescription(String description)
      Set a description for this action.
      Parameters:
      description - the description for this action.
      Returns:
      the same instance of the ActionBuilder.
    • withStage

      public Action.ActionBuilder withStage(String stage)
      Set a stage for this action.
      Parameters:
      stage - the stage for this action.
      Returns:
      the same instance of the ActionBuilder.
    • withErrorMessage

      public Action.ActionBuilder withErrorMessage(String errorMessage)
      Sets the error message to present to the caller when the FAILURE node is reached.

      It is up to the caller to apply localisation.

      Parameters:
      errorMessage - The error message.
      Returns:
      the same instance of the ActionBuilder.
    • withLockoutMessage

      public Action.ActionBuilder withLockoutMessage(String lockoutMessage)
      Sets the error message to present to the caller when the user is locked out.

      It is up to the caller to apply localisation.

      Parameters:
      lockoutMessage - The lockout message.
      Returns:
      the same instance of the ActionBuilder.
    • withUniversalId

      @Deprecated public Action.ActionBuilder withUniversalId(String universalId)
      Sets the universal id of the user object.
      Parameters:
      universalId - The universal id of the user object.
      Returns:
      the same instance of the ActionBuilder.
    • withUniversalId

      @Deprecated public Action.ActionBuilder withUniversalId(Optional<String> universalId)
      Sets the universal id of the user object.

      If universalId is empty no action will take place.

      Parameters:
      universalId - The optional universal id of the user object.
      Returns:
      the same instance of the ActionBuilder.
    • putSessionProperty

      public Action.ActionBuilder putSessionProperty(String key, String value)
      Add a new session property.
      Parameters:
      key - The key for the property.
      value - The value for the property.
      Returns:
      the same instance of the ActionBuilder.
    • removeSessionProperty

      public Action.ActionBuilder removeSessionProperty(String key)
      Remove a previously set session property.
      Parameters:
      key - The key for the property.
      Returns:
      the same instance of the ActionBuilder.
    • addSessionHook

      public Action.ActionBuilder addSessionHook(Class<? extends TreeHook> sessionHook, UUID nodeId, String nodeType)
      Sets a class that will be run after successful login. The class has to implement TreeHook.
      Parameters:
      sessionHook - The class to be run.
      nodeId - The ID of the node.
      nodeType - The type of the node.
      Returns:
      the same instance of ActionBuilder
    • addSessionHook

      public Action.ActionBuilder addSessionHook(Class<? extends TreeHook> sessionHook, UUID nodeId, String nodeType, JsonValue data)
      Sets a class that will be run after successful login. The class has to implement TreeHook.
      Parameters:
      sessionHook - The class to be run.
      nodeId - The ID of the node.
      nodeType - The type of the node.
      data - The additional data for session hook.
      Returns:
      the same instance of ActionBuilder
    • addSessionHooks

      public Action.ActionBuilder addSessionHooks(List<JsonValue> sessionHooks)
      Adds session hooks to the list.
      Parameters:
      sessionHooks - List of the hooks to add.
      Returns:
      the same instance of ActionBuilder.
    • addWebhook

      public Action.ActionBuilder addWebhook(String webhookName)
      Adds a webhook to the list.
      Parameters:
      webhookName - The webhook name created on the webhook service.
      Returns:
      the same instance of ActionBuilder.
    • addWebhooks

      public Action.ActionBuilder addWebhooks(List<String> webhooks)
      Adds webhooks to the list.
      Parameters:
      webhooks - List of webhooks that run after logout.
      Returns:
      the same instance of ActionBuilder.
    • addNodeType

      public Action.ActionBuilder addNodeType(TreeContext context, String authName)
      Update the NodeType session property, and the NodeType sharedState value. This method will copy the supplied TreeContext's shared state into this builder if the builder does not already have a sharedState set.
      Parameters:
      context - The tree context.
      authName - Name of the auth module just passed
      Returns:
      the same instance of ActionBuilder.
    • withIdentifiedIdentity

      public Action.ActionBuilder withIdentifiedIdentity(String username, IdType identityType)
      Set the identified identity that has been verified to exist in an identity store.

      The identity may or may not have been authenticated as part of the tree execution.

      Parameters:
      username - the username of the identified identity.
      identityType - the identity type of the identified identity. Must be one of the identity types defined in com.sun.identity.idm.IdType.
      Returns:
      this action builder.
    • withIdentifiedIdentity

      public Action.ActionBuilder withIdentifiedIdentity(AMIdentity identity)
      Set the identified identity that has been verified to exist in an identity store.

      The identity may or may not have been authenticated as part of the tree execution.

      Parameters:
      identity - the identified identity.
      Returns:
      this action builder.
    • build

      public Action build()
      Build the Action.
      Returns:
      an Action.
      Throws:
      IllegalStateException - if the builder is called before building mandatory fields.