Package org.wildfly.security.auth.server
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 Summary
Modifier and TypeMethodDescriptionget()Get the current associated identity.<T,U> boolean runAsBiPredicate(BiPredicate<T, U> action, T param1, U param2) Run an action under this identity.<T,U> void runAsConsumer(BiConsumer<T, U> action, T parameter1, U parameter2) Run an action under this identity.<T,U, E extends Exception>
voidrunAsConsumerEx(org.wildfly.common.function.ExceptionBiConsumer<T, U, E> action, T parameter1, U parameter2) Run an action under this identity.<T,U, E extends Exception>
booleanrunAsExBiPredicate(org.wildfly.common.function.ExceptionBiPredicate<T, U, E> action, T param1, U param2) Run an action under this identity.<T,U, R> R runAsFunction(BiFunction<T, U, R> action, T parameter1, U parameter2) Run an action under this identity.<T,U, R, E extends Exception>
RrunAsFunctionEx(org.wildfly.common.function.ExceptionBiFunction<T, U, R, E> action, T parameter1, U parameter2) Run an action under this identity.<T> voidrunAsObjIntConsumer(ObjIntConsumer<T> action, T parameter1, int parameter2) Run an action under this identity.<T,E extends Exception>
voidrunAsObjIntConsumerEx(org.wildfly.common.function.ExceptionObjIntConsumer<T, E> action, T parameter1, int parameter2) Run an action under this identity.voidsetIdentity(SecurityIdentity securityIdentity) Set the current associated identity.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.wildfly.security.auth.server.Scoped
runAs, runAs, runAsAction, runAsConsumer, runAsConsumerEx, runAsExceptionAction, runAsExIntFunction, runAsExLongFunction, runAsExPredicate, runAsFunction, runAsFunctionEx, runAsIntFunction, runAsLongFunction, runAsPredicate, runAsSupplier, runAsSupplierEx
-
Method Details
-
setIdentity
Set the current associated identity.- Parameters:
securityIdentity- the current associated identity (must not benull)
-
get
Get the current associated identity.- Specified by:
getin interfaceSupplier<SecurityIdentity>- Returns:
- the current associated identity (not
null)
-
runAsFunction
Description copied from interface:ScopedRun an action under this identity.- Specified by:
runAsFunctionin interfaceScoped- Type Parameters:
T- the action first parameter typeU- the action second parameter typeR- the action return type- Parameters:
action- the action to runparameter1- the first parameter to pass to the actionparameter2- the second parameter to pass to the action- Returns:
- the action result (may be
null)
-
runAsConsumer
Description copied from interface:ScopedRun an action under this identity.- Specified by:
runAsConsumerin interfaceScoped- Type Parameters:
T- the action first parameter typeU- the action second parameter type- Parameters:
action- the action to runparameter1- the first parameter to pass to the actionparameter2- the second parameter to pass to the action
-
runAsObjIntConsumer
Description copied from interface:ScopedRun an action under this identity.- Specified by:
runAsObjIntConsumerin interfaceScoped- Type Parameters:
T- the action first parameter type- Parameters:
action- the action to runparameter1- the first parameter to pass to the actionparameter2- the second parameter to pass to the action
-
runAsFunctionEx
public <T,U, R runAsFunctionExR, E extends Exception> (org.wildfly.common.function.ExceptionBiFunction<T, U, throws ER, E> action, T parameter1, U parameter2) Description copied from interface:ScopedRun an action under this identity.- Specified by:
runAsFunctionExin interfaceScoped- Type Parameters:
T- the action first parameter typeU- the action second parameter typeR- the action return typeE- the action exception type- Parameters:
action- the action to runparameter1- the first parameter to pass to the actionparameter2- 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, void runAsConsumerExE extends Exception> (org.wildfly.common.function.ExceptionBiConsumer<T, U, throws EE> action, T parameter1, U parameter2) Description copied from interface:ScopedRun an action under this identity.- Specified by:
runAsConsumerExin interfaceScoped- Type Parameters:
T- the action first parameter typeU- the action second parameter typeE- the action exception type- Parameters:
action- the action to runparameter1- the first parameter to pass to the actionparameter2- 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 EDescription copied from interface:ScopedRun an action under this identity.- Specified by:
runAsObjIntConsumerExin interfaceScoped- Type Parameters:
T- the action first parameter typeE- the action exception type- Parameters:
action- the action to runparameter1- the first parameter to pass to the actionparameter2- the second parameter to pass to the action- Throws:
E- if the action throws this exception
-
runAsBiPredicate
Description copied from interface:ScopedRun an action under this identity.- Specified by:
runAsBiPredicatein interfaceScoped- Type Parameters:
T- the first parameter typeU- the second parameter type- Parameters:
action- the task to run (must not benull)param1- the first parameter to pass to the taskparam2- the second parameter to pass to the task- Returns:
- the action return value
-
runAsExBiPredicate
public <T,U, boolean runAsExBiPredicateE extends Exception> (org.wildfly.common.function.ExceptionBiPredicate<T, U, throws EE> action, T param1, U param2) Description copied from interface:ScopedRun an action under this identity.- Specified by:
runAsExBiPredicatein interfaceScoped- Type Parameters:
T- the first parameter typeU- the second parameter typeE- the exception type- Parameters:
action- the task to run (must not benull)param1- the first parameter to pass to the taskparam2- the second parameter to pass to the task- Returns:
- the action return value
- Throws:
E- if an exception occurs in the task
-