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
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedPeerIdentityContext()Construct a new instance.
-
Method Summary
All 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.PeerIdentitygetCurrentIdentity()Get the currently set peer identity for this context.booleanowns(PeerIdentity identity)Determine whether this context owns the given identity.
-
-
-
Method Detail
-
getCurrentIdentity
public 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
-
authenticate
public 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
-
constructIdentity
protected 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
-
owns
public 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
-
-