
public abstract class PeerIdentity extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
PeerIdentity.Configuration
The opaque configuration to apply to a peer identity.
|
| Modifier | Constructor and Description |
|---|---|
protected |
PeerIdentity(PeerIdentity.Configuration configuration,
Principal peerPrincipal)
Construct a new instance.
|
| Modifier and Type | Method and Description |
|---|---|
Attributes.Entry |
getPeerAttribute(String key)
Get a specific attribute value for the peer identity.
|
Attributes |
getPeerAttributes()
Get the attribute set for the peer identity.
|
protected PeerIdentityContext |
getPeerIdentityContext()
Get the peer identity context for this identity.
|
Principal |
getPeerPrincipal()
Get the peer principal.
|
Set<String> |
getPeerRoles()
Get the peer identity roles.
|
boolean |
hasPeerRole(String roleName)
Determine whether the peer identity has a given role name.
|
boolean |
isSamePeerIdentityContext(PeerIdentity other)
Determine if the peer identity context of this identity is the same as that of the given identity.
|
protected void |
postAssociate()
Perform an optional post-association action, called after association with the current thread has completed.
|
protected void |
preAssociate()
Perform an optional pre-association action, called before association with the current thread.
|
<T> T |
runAs(Callable<T> callable)
Run an action under this identity.
|
<T,P> T |
runAs(P parameter,
ParametricPrivilegedAction<T,P> action)
Run an action under this identity.
|
<T,P> T |
runAs(P parameter,
ParametricPrivilegedExceptionAction<T,P> action)
Run an action under this identity.
|
<T> T |
runAs(PrivilegedAction<T> action)
Run an action under this identity.
|
<T> T |
runAs(PrivilegedExceptionAction<T> action)
Run an action under this identity.
|
void |
runAs(Runnable runnable)
Run an action under this identity.
|
static <T> T |
runAsAll(Callable<T> callable,
PeerIdentity... identities)
Run an action under a series of identities.
|
static <T,P> T |
runAsAll(P parameter,
ParametricPrivilegedAction<T,P> privilegedAction,
PeerIdentity... identities)
Run an action under a series of identities.
|
static <T,P> T |
runAsAll(P parameter,
ParametricPrivilegedExceptionAction<T,P> privilegedAction,
PeerIdentity... identities)
Run an action under a series of identities.
|
static <T> T |
runAsAll(PrivilegedAction<T> privilegedAction,
PeerIdentity... identities)
Run an action under a series of identities.
|
static <T> T |
runAsAll(PrivilegedExceptionAction<T> privilegedAction,
PeerIdentity... identities)
Run an action under a series of identities.
|
static void |
runAsAll(Runnable runnable,
PeerIdentity... identities)
Run an action under a series of identities.
|
static <T> void |
runAsAllConsumer(T parameter,
Consumer<T> privilegedAction,
PeerIdentity... identities)
Run an action under a series of identities.
|
static <T,U> void |
runAsAllConsumer(T parameter1,
U parameter2,
BiConsumer<T,U> privilegedAction,
PeerIdentity... identities)
Run an action under a series of identities.
|
static <R,T> R |
runAsAllFunction(T parameter,
Function<T,R> privilegedAction,
PeerIdentity... identities)
Run an action under a series of identities.
|
static <T,U,R> R |
runAsAllFunction(T parameter1,
U parameter2,
BiFunction<T,U,R> privilegedAction,
PeerIdentity... identities)
Run an action under a series of identities.
|
static <T> void |
runAsAllObjIntConsumer(T parameter1,
int parameter2,
ObjIntConsumer<T> privilegedAction,
PeerIdentity... identities)
Run an action under a series of identities.
|
static <T> T |
runAsAllSupplier(Supplier<T> action,
PeerIdentity... identities)
Run an action under a series of identities.
|
<T> void |
runAsConsumer(T parameter,
Consumer<T> action)
Run an action under this identity.
|
<T,U> void |
runAsConsumer(T parameter1,
U parameter2,
BiConsumer<T,U> action)
Run an action under this identity.
|
<T,R> R |
runAsFunction(T parameter,
Function<T,R> action)
Run an action under this identity.
|
<T,U,R> R |
runAsFunction(T parameter1,
U parameter2,
BiFunction<T,U,R> action)
Run an action under this identity.
|
<T> T |
runAsSupplier(Supplier<T> supplier)
Run an action under this identity.
|
protected PeerIdentity(PeerIdentity.Configuration configuration, Principal peerPrincipal)
configuration - the opaque configuration (must not be null)peerPrincipal - the peer principal (must not be null)protected void preAssociate()
protected void postAssociate()
public boolean isSamePeerIdentityContext(PeerIdentity other)
other - the other peer identitytrue if the identities share a context, false otherwisepublic void runAs(Runnable runnable)
runnable - the action to runpublic <T> T runAs(Callable<T> callable) throws Exception
T - the action return typecallable - the action to runnull)PrivilegedActionException - if the action failsExceptionpublic <T> T runAs(PrivilegedAction<T> action)
T - the action return typeaction - the action to runnull)public <T> T runAs(PrivilegedExceptionAction<T> action) throws PrivilegedActionException
T - the action return typeaction - the action to runnull)PrivilegedActionException - if the action failspublic <T,P> T runAs(P parameter,
ParametricPrivilegedAction<T,P> action)
T - the action return typeP - the action parameter typeparameter - the parameter to pass to the actionaction - the action to runnull)public <T,P> T runAs(P parameter,
ParametricPrivilegedExceptionAction<T,P> action)
throws PrivilegedActionException
T - the action return typeP - the action parameter typeparameter - the parameter to pass to the actionaction - the action to runnull)PrivilegedActionException - if the action failspublic <T,R> R runAsFunction(T parameter,
Function<T,R> action)
T - the action parameter typeR - the action return typeparameter - the parameter to pass to the actionaction - the action to runnull)public <T,U,R> R runAsFunction(T parameter1,
U parameter2,
BiFunction<T,U,R> action)
T - the action first parameter typeU - the action second parameter typeR - the action return typeparameter1 - the first parameter to pass to the actionparameter2 - the second parameter to pass to the actionaction - the action to runnull)public <T> void runAsConsumer(T parameter,
Consumer<T> action)
T - the action parameter typeparameter - the parameter to pass to the actionaction - the action to runpublic <T,U> void runAsConsumer(T parameter1,
U parameter2,
BiConsumer<T,U> action)
T - the action first parameter typeU - the action second parameter typeparameter1 - the first parameter to pass to the actionparameter2 - the second parameter to pass to the actionaction - the action to runpublic <T> T runAsSupplier(Supplier<T> supplier) throws Exception
T - the action return typesupplier - the action to runnull)PrivilegedActionException - if the action failsExceptionpublic static void runAsAll(Runnable runnable, PeerIdentity... identities)
runnable - the action to runidentities - the identities to usepublic static <T> T runAsAll(Callable<T> callable, PeerIdentity... identities) throws Exception
T - the action return typecallable - the action to runidentities - the identities to useExceptionpublic static <T> T runAsAll(PrivilegedAction<T> privilegedAction, PeerIdentity... identities)
T - the action return typeprivilegedAction - the action to runidentities - the identities to usepublic static <T> T runAsAll(PrivilegedExceptionAction<T> privilegedAction, PeerIdentity... identities) throws PrivilegedActionException
T - the action return typeprivilegedAction - the action to runidentities - the identities to usePrivilegedActionException - if the action throws an exceptionpublic static <T,P> T runAsAll(P parameter,
ParametricPrivilegedAction<T,P> privilegedAction,
PeerIdentity... identities)
T - the action return typeP - the action parameter typeparameter - the parameter to pass to the actionprivilegedAction - the action to runidentities - the identities to usepublic static <T,P> T runAsAll(P parameter,
ParametricPrivilegedExceptionAction<T,P> privilegedAction,
PeerIdentity... identities)
throws PrivilegedActionException
T - the action return typeP - the action parameter typeparameter - the parameter to pass to the actionprivilegedAction - the action to runidentities - the identities to usePrivilegedActionException - if the action throws an exceptionpublic static <R,T> R runAsAllFunction(T parameter,
Function<T,R> privilegedAction,
PeerIdentity... identities)
R - the action return typeT - the action parameter typeparameter - the parameter to pass to the actionprivilegedAction - the action to runidentities - the identities to usepublic static <T,U,R> R runAsAllFunction(T parameter1,
U parameter2,
BiFunction<T,U,R> privilegedAction,
PeerIdentity... identities)
T - the action first parameter typeU - the action second parameter typeR - the action return typeparameter1 - the first parameter to pass to the actionparameter2 - the second parameter to pass to the actionprivilegedAction - the action to runidentities - the identities to usepublic static <T> void runAsAllConsumer(T parameter,
Consumer<T> privilegedAction,
PeerIdentity... identities)
T - the action parameter typeparameter - the parameter to pass to the actionprivilegedAction - the action to runidentities - the identities to usepublic static <T,U> void runAsAllConsumer(T parameter1,
U parameter2,
BiConsumer<T,U> privilegedAction,
PeerIdentity... identities)
T - the action first parameter typeU - the action second parameter typeparameter1 - the first parameter to pass to the actionparameter2 - the second parameter to pass to the actionprivilegedAction - the action to runidentities - the identities to usepublic static <T> void runAsAllObjIntConsumer(T parameter1,
int parameter2,
ObjIntConsumer<T> privilegedAction,
PeerIdentity... identities)
T - the action first parameter typeparameter1 - the first parameter to pass to the actionparameter2 - the second parameter to pass to the actionprivilegedAction - the action to runidentities - the identities to usepublic static <T> T runAsAllSupplier(Supplier<T> action, PeerIdentity... identities)
T - the action return typeaction - the action to runidentities - the identities to usepublic Principal getPeerPrincipal()
null)public Set<String> getPeerRoles()
null)public boolean hasPeerRole(String roleName)
false.roleName - the role nametrue if the peer identity has the role, false otherwisepublic Attributes getPeerAttributes()
public Attributes.Entry getPeerAttribute(String key)
null.key - the attribute namenull if there is no matching entryprotected final PeerIdentityContext getPeerIdentityContext()
null)Copyright © 2020 JBoss by Red Hat. All rights reserved.