Package org.wildfly.security.auth.client
Class PeerIdentityContext
- java.lang.Object
- 
- org.wildfly.security.auth.client.PeerIdentityContext
 
- 
 public abstract class PeerIdentityContext extends Object A peer identity context. The peer identity is relevant only to this context.- Author:
- David M. Lloyd
 
- 
- 
Field SummaryFields Modifier and Type Field Description private ThreadLocal<PeerIdentity>currentIdentity
 - 
Constructor SummaryConstructors Modifier Constructor Description protectedPeerIdentityContext()Construct a new instance.
 - 
Method SummaryAll Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract PeerIdentityauthenticate(AuthenticationConfiguration authenticationConfiguration)Authenticate a new peer identity.protected <I> IconstructIdentity(Function<PeerIdentity.Configuration,I> constructFunction)Construct a new peer identity.(package private) PeerIdentitygetAndSetPeerIdentity(PeerIdentity newIdentity)PeerIdentitygetCurrentIdentity()Get the currently set peer identity for this context.booleanowns(PeerIdentity identity)Determine whether this context owns the given identity.(package private) voidsetPeerIdentity(PeerIdentity newIdentity)
 
- 
- 
- 
Field Detail- 
currentIdentityprivate final ThreadLocal<PeerIdentity> currentIdentity 
 
- 
 - 
Method Detail- 
getCurrentIdentitypublic PeerIdentity getCurrentIdentity() Get the currently set peer identity for this context.- Returns:
- the currently set peer identity for this context, or nullif no identity is set
 
 - 
authenticatepublic abstract PeerIdentity authenticate(AuthenticationConfiguration authenticationConfiguration) throws AuthenticationException Authenticate a new peer identity. The authentication operation may be deferred if the backend cannot perform authentications on demand. If so, and the authentication fails, aReauthenticationExceptionmay be thrown at a later time.- Parameters:
- authenticationConfiguration- the authentication configuration to use
- Returns:
- the peer identity
- Throws:
- AuthenticationException- if an immediate authentication error occurs
 
 - 
constructIdentityprotected final <I> I constructIdentity(Function<PeerIdentity.Configuration,I> constructFunction) Construct a new peer identity. The given function uses the opaque one-time configuration object to construct the identity, which must be passed as-is to the constructor of thePeerIdentityclass. This object must not be retained or made available after the identity is constructed; such misuse may result in an exception or undefined behavior.- Parameters:
- constructFunction- a function that, when applied, constructs a new peer identity
- Returns:
- the constructed peer identity
 
 - 
ownspublic final boolean owns(PeerIdentity identity) Determine whether this context owns the given identity.- Parameters:
- identity- the identity
- Returns:
- trueif this context owns the identity,- falseotherwise
 
 - 
getAndSetPeerIdentityfinal PeerIdentity getAndSetPeerIdentity(PeerIdentity newIdentity) 
 - 
setPeerIdentityvoid setPeerIdentity(PeerIdentity newIdentity) 
 
- 
 
-