Interface RealmIdentity
- All Known Subinterfaces:
ModifiableRealmIdentity
public interface RealmIdentity
A representation of a pre-authentication identity.
The life of a
RealmIdentity is short and is for a specific authentication attempt. A SecurityRealm creating a
RealmIdentity does not confirm the existence of the identity. The exists() method must be used
for that purpose.- Author:
- Darran Lofthouse
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final RealmIdentityThe anonymous realm identity.static final RealmIdentityAn identity for a non-existent user. -
Method Summary
Modifier and TypeMethodDescriptiondefault <C extends org.wildfly.security.credential.Credential, R>
RapplyToCredential(Class<C> credentialType, String algorithmName, AlgorithmParameterSpec parameterSpec, Function<C, R> function) Apply the given function to the acquired credential, if it is set and of the given type, algorithm, and parameters.default <C extends org.wildfly.security.credential.Credential, R>
RapplyToCredential(Class<C> credentialType, String algorithmName, Function<C, R> function) Apply the given function to the acquired credential, if it is set and of the given type and algorithm.default <C extends org.wildfly.security.credential.Credential, R>
RapplyToCredential(Class<C> credentialType, Function<C, R> function) Apply the given function to the acquired credential, if it is set and of the given type.default voiddispose()Dispose this realm identity after a completed authentication attempt.booleanexists()Determine if the identity exists in lieu of verifying or acquiring a credential.default AttributesGet the attributes for the realm identity.default AuthorizationIdentityGet an authorization identity for this pre-authenticated identity.<C extends org.wildfly.security.credential.Credential>
CgetCredential(Class<C> credentialType) Acquire a credential of the given type.default <C extends org.wildfly.security.credential.Credential>
CgetCredential(Class<C> credentialType, String algorithmName) Acquire a credential of the given type and algorithm name.default <C extends org.wildfly.security.credential.Credential>
CgetCredential(Class<C> credentialType, String algorithmName, AlgorithmParameterSpec parameterSpec) Acquire a credential of the given type and algorithm name.default org.wildfly.security.auth.SupportLevelgetCredentialAcquireSupport(Class<? extends org.wildfly.security.credential.Credential> credentialType, String algorithmName) Deprecated.Transition method; remove before GA.org.wildfly.security.auth.SupportLevelgetCredentialAcquireSupport(Class<? extends org.wildfly.security.credential.Credential> credentialType, String algorithmName, AlgorithmParameterSpec parameterSpec) Determine whether a given credential type is definitely obtainable, possibly obtainable, or definitely not obtainable for this identity.org.wildfly.security.auth.SupportLevelgetEvidenceVerifySupport(Class<? extends org.wildfly.security.evidence.Evidence> evidenceType, String algorithmName) Determine whether a given type of evidence is definitely verifiable, possibly verifiable, or definitely not verifiable.Get the principal that canonically identifies the identity within the realm.default voidupdateCredential(org.wildfly.security.credential.Credential credential) Update a credential of this realm identity.booleanverifyEvidence(org.wildfly.security.evidence.Evidence evidence) Verify the given evidence against a credential of this identity.
-
Field Details
-
ANONYMOUS
The anonymous realm identity. -
NON_EXISTENT
An identity for a non-existent user.
-
-
Method Details
-
getRealmIdentityPrincipal
Principal getRealmIdentityPrincipal()Get the principal that canonically identifies the identity within the realm. This method may return the principal object which was passed in as a parameter toSecurityRealm.getRealmIdentity(Principal)(a.k.a. domain principal), but is not required to do so. Any existent realm identity (i.e. any identity which returnstrueon invocation ofexists()) must return a non-nullprincipal.- Returns:
- the principal for this realm identity (may not be
null)
-
getCredentialAcquireSupport
default org.wildfly.security.auth.SupportLevel getCredentialAcquireSupport(Class<? extends org.wildfly.security.credential.Credential> credentialType, String algorithmName) throws RealmUnavailableException Deprecated.Transition method; remove before GA.- Throws:
RealmUnavailableException
-
getCredentialAcquireSupport
org.wildfly.security.auth.SupportLevel getCredentialAcquireSupport(Class<? extends org.wildfly.security.credential.Credential> credentialType, String algorithmName, AlgorithmParameterSpec parameterSpec) throws RealmUnavailableException Determine whether a given credential type is definitely obtainable, possibly obtainable, or definitely not obtainable for this identity.- Parameters:
credentialType- the exact credential type (must not benull)algorithmName- the algorithm name, ornullif any algorithm is acceptable or the credential type does not support algorithm namesparameterSpec- the algorithm parameters to match, ornullif any parameters are acceptable or the credential type does not support algorithm parameters- Returns:
- the level of support for this credential type (may not be
null) - Throws:
RealmUnavailableException- if the realm is not able to handle requests for any reason
-
getCredential
<C extends org.wildfly.security.credential.Credential> C getCredential(Class<C> credentialType) throws RealmUnavailableException Acquire a credential of the given type.- Type Parameters:
C- the credential type- Parameters:
credentialType- the credential type class (must not benull)- Returns:
- the credential, or
nullif no such credential exists - Throws:
RealmUnavailableException- if the realm is not able to handle requests for any reason
-
getCredential
default <C extends org.wildfly.security.credential.Credential> C getCredential(Class<C> credentialType, String algorithmName) throws RealmUnavailableException Acquire a credential of the given type and algorithm name. Realms which support more than one credential of a given type must override this method.- Type Parameters:
C- the credential type- Parameters:
credentialType- the credential type class (must not benull)algorithmName- the algorithm name, ornullif any algorithm is acceptable or the credential type does not support algorithm names- Returns:
- the credential, or
nullif no such credential exists - Throws:
RealmUnavailableException- if the realm is not able to handle requests for any reason
-
getCredential
default <C extends org.wildfly.security.credential.Credential> C getCredential(Class<C> credentialType, String algorithmName, AlgorithmParameterSpec parameterSpec) throws RealmUnavailableException Acquire a credential of the given type and algorithm name. Realms which support more than one credential of a given type and algorithm must override this method.- Type Parameters:
C- the credential type- Parameters:
credentialType- the credential type class (must not benull)algorithmName- the algorithm name, ornullif any algorithm is acceptable or the credential type does not support algorithm namesparameterSpec- the algorithm parameters to match, ornullif any parameters are acceptable or the credential type does not support algorithm parameters- Returns:
- the credential, or
nullif no such credential exists - Throws:
RealmUnavailableException- if the realm is not able to handle requests for any reason
-
applyToCredential
default <C extends org.wildfly.security.credential.Credential, R> R applyToCredential(Class<C> credentialType, Function<C, R> function) throws RealmUnavailableExceptionApply the given function to the acquired credential, if it is set and of the given type.- Type Parameters:
C- the credential typeR- the return type- Parameters:
credentialType- the credential type class (must not benull)function- the function to apply (must not benull)- Returns:
- the result of the function, or
nullif the criteria are not met - Throws:
RealmUnavailableException- if the realm is not able to handle requests for any reason
-
applyToCredential
default <C extends org.wildfly.security.credential.Credential, R> R applyToCredential(Class<C> credentialType, String algorithmName, Function<C, R> function) throws RealmUnavailableExceptionApply the given function to the acquired credential, if it is set and of the given type and algorithm.- Type Parameters:
C- the credential typeR- the return type- Parameters:
credentialType- the credential type class (must not benull)algorithmName- the algorithm name, ornullif any algorithm is acceptable or the credential type does not support algorithm namesfunction- the function to apply (must not benull)- Returns:
- the result of the function, or
nullif the criteria are not met - Throws:
RealmUnavailableException- if the realm is not able to handle requests for any reason
-
applyToCredential
default <C extends org.wildfly.security.credential.Credential, R> R applyToCredential(Class<C> credentialType, String algorithmName, AlgorithmParameterSpec parameterSpec, Function<C, R> function) throws RealmUnavailableExceptionApply the given function to the acquired credential, if it is set and of the given type, algorithm, and parameters.- Type Parameters:
C- the credential typeR- the return type- Parameters:
credentialType- the credential type class (must not benull)algorithmName- the algorithm name, ornullif any algorithm is acceptable or the credential type does not support algorithm namesparameterSpec- the algorithm parameters to match, ornullif any parameters are acceptable or the credential type does not support algorithm parametersfunction- the function to apply (must not benull)- Returns:
- the result of the function, or
nullif the criteria are not met - Throws:
RealmUnavailableException- if the realm is not able to handle requests for any reason
-
updateCredential
default void updateCredential(org.wildfly.security.credential.Credential credential) throws RealmUnavailableException Update a credential of this realm identity.- Parameters:
credential- the new credential (must not benull)- Throws:
UnsupportedOperationException- if the implementing class does not support updating a credentialRealmUnavailableException- if the realm is not able to handle requests for any reason
-
getEvidenceVerifySupport
org.wildfly.security.auth.SupportLevel getEvidenceVerifySupport(Class<? extends org.wildfly.security.evidence.Evidence> evidenceType, String algorithmName) throws RealmUnavailableException Determine whether a given type of evidence is definitely verifiable, possibly verifiable, or definitely not verifiable.- Parameters:
evidenceType- the type of evidence to be verified (must not benull)algorithmName- the algorithm name, ornullif any algorithm is acceptable or the evidence type does not support algorithm names- Returns:
- the level of support for this evidence type
- Throws:
RealmUnavailableException- if the realm is not able to handle requests for any reason
-
verifyEvidence
boolean verifyEvidence(org.wildfly.security.evidence.Evidence evidence) throws RealmUnavailableException Verify the given evidence against a credential of this identity. The credential to be used is selected based on the evidence type.- Parameters:
evidence- the evidence to verify- Returns:
trueif verification was successful,falseotherwise- Throws:
RealmUnavailableException- if the realm is not able to handle requests for any reason
-
exists
Determine if the identity exists in lieu of verifying or acquiring a credential. This method is intended to be used to verify an identity for non-authentication purposes only. Implementations of this method should returnfalseup until the point it is known that a call togetAuthorizationIdentity()can successfully return an identity. If a realm can load an identity independently of credential acquisition and evidence verification if not already loaded it should be loaded at the time of this call to return an accurate result.- Returns:
trueif the identity exists in this realm,falseotherwise- Throws:
RealmUnavailableException- if the realm is not able to handle requests for any reason
-
dispose
default void dispose()Dispose this realm identity after a completed authentication attempt. -
getAuthorizationIdentity
Get an authorization identity for this pre-authenticated identity.- Returns:
- the authorization identity (may not be
null) - Throws:
IllegalStateException- if called for an identity that does not existRealmUnavailableException- if the realm is not able to handle requests for any reason
-
getAttributes
Get the attributes for the realm identity.- Returns:
- the attributes, or
nullif the implementing class does not support getting attributes - Throws:
RealmUnavailableException- if accessing the attributes fails for some reason
-