Class FlexibleIdentityAssociation

java.lang.Object
org.wildfly.security.auth.server.FlexibleIdentityAssociation
All Implemented Interfaces:
Supplier<SecurityIdentity>, Scoped

public final class FlexibleIdentityAssociation extends Object implements Scoped, Supplier<SecurityIdentity>
A flexible identity association which can have its current identity modified. Modifying the identity association will affect the current identity of any thread which is currently executing within the scope of this association.
Author:
David M. Lloyd
See Also:
  • Method Details

    • setIdentity

      public void setIdentity(SecurityIdentity securityIdentity)
      Set the current associated identity.
      Parameters:
      securityIdentity - the current associated identity (must not be null)
    • get

      public SecurityIdentity get()
      Get the current associated identity.
      Specified by:
      get in interface Supplier<SecurityIdentity>
      Returns:
      the current associated identity (not null)
    • runAsFunction

      public <T, U, R> R runAsFunction(BiFunction<T,U,R> action, T parameter1, U parameter2)
      Description copied from interface: Scoped
      Run an action under this identity.
      Specified by:
      runAsFunction in interface Scoped
      Type Parameters:
      T - the action first parameter type
      U - the action second parameter type
      R - the action return type
      Parameters:
      action - the action to run
      parameter1 - the first parameter to pass to the action
      parameter2 - the second parameter to pass to the action
      Returns:
      the action result (may be null)
    • runAsConsumer

      public <T, U> void runAsConsumer(BiConsumer<T,U> action, T parameter1, U parameter2)
      Description copied from interface: Scoped
      Run an action under this identity.
      Specified by:
      runAsConsumer in interface Scoped
      Type Parameters:
      T - the action first parameter type
      U - the action second parameter type
      Parameters:
      action - the action to run
      parameter1 - the first parameter to pass to the action
      parameter2 - the second parameter to pass to the action
    • runAsObjIntConsumer

      public <T> void runAsObjIntConsumer(ObjIntConsumer<T> action, T parameter1, int parameter2)
      Description copied from interface: Scoped
      Run an action under this identity.
      Specified by:
      runAsObjIntConsumer in interface Scoped
      Type Parameters:
      T - the action first parameter type
      Parameters:
      action - the action to run
      parameter1 - the first parameter to pass to the action
      parameter2 - the second parameter to pass to the action
    • runAsFunctionEx

      public <T, U, R, E extends Exception> R runAsFunctionEx(org.wildfly.common.function.ExceptionBiFunction<T,U,R,E> action, T parameter1, U parameter2) throws E
      Description copied from interface: Scoped
      Run an action under this identity.
      Specified by:
      runAsFunctionEx in interface Scoped
      Type Parameters:
      T - the action first parameter type
      U - the action second parameter type
      R - the action return type
      E - the action exception type
      Parameters:
      action - the action to run
      parameter1 - the first parameter to pass to the action
      parameter2 - the second parameter to pass to the action
      Returns:
      the action result (may be null)
      Throws:
      E - if the action throws this exception
    • runAsConsumerEx

      public <T, U, E extends Exception> void runAsConsumerEx(org.wildfly.common.function.ExceptionBiConsumer<T,U,E> action, T parameter1, U parameter2) throws E
      Description copied from interface: Scoped
      Run an action under this identity.
      Specified by:
      runAsConsumerEx in interface Scoped
      Type Parameters:
      T - the action first parameter type
      U - the action second parameter type
      E - the action exception type
      Parameters:
      action - the action to run
      parameter1 - the first parameter to pass to the action
      parameter2 - the second parameter to pass to the action
      Throws:
      E - if the action throws this exception
    • runAsObjIntConsumerEx

      public <T, E extends Exception> void runAsObjIntConsumerEx(org.wildfly.common.function.ExceptionObjIntConsumer<T,E> action, T parameter1, int parameter2) throws E
      Description copied from interface: Scoped
      Run an action under this identity.
      Specified by:
      runAsObjIntConsumerEx in interface Scoped
      Type Parameters:
      T - the action first parameter type
      E - the action exception type
      Parameters:
      action - the action to run
      parameter1 - the first parameter to pass to the action
      parameter2 - the second parameter to pass to the action
      Throws:
      E - if the action throws this exception
    • runAsBiPredicate

      public <T, U> boolean runAsBiPredicate(BiPredicate<T,U> action, T param1, U param2)
      Description copied from interface: Scoped
      Run an action under this identity.
      Specified by:
      runAsBiPredicate in interface Scoped
      Type Parameters:
      T - the first parameter type
      U - the second parameter type
      Parameters:
      action - the task to run (must not be null)
      param1 - the first parameter to pass to the task
      param2 - the second parameter to pass to the task
      Returns:
      the action return value
    • runAsExBiPredicate

      public <T, U, E extends Exception> boolean runAsExBiPredicate(org.wildfly.common.function.ExceptionBiPredicate<T,U,E> action, T param1, U param2) throws E
      Description copied from interface: Scoped
      Run an action under this identity.
      Specified by:
      runAsExBiPredicate in interface Scoped
      Type Parameters:
      T - the first parameter type
      U - the second parameter type
      E - the exception type
      Parameters:
      action - the task to run (must not be null)
      param1 - the first parameter to pass to the task
      param2 - the second parameter to pass to the task
      Returns:
      the action return value
      Throws:
      E - if an exception occurs in the task