public interface RealmIdentity
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.Modifier and Type | Field and Description |
---|---|
static RealmIdentity |
ANONYMOUS
The anonymous realm identity.
|
static RealmIdentity |
NON_EXISTENT
An identity for a non-existent user.
|
Modifier and Type | Method and Description |
---|---|
default <C extends Credential,R> |
applyToCredential(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 <C extends Credential,R> |
applyToCredential(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 Credential,R> |
applyToCredential(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 void |
dispose()
Dispose this realm identity after a completed authentication attempt.
|
boolean |
exists()
Determine if the identity exists in lieu of verifying or acquiring a credential.
|
default Attributes |
getAttributes()
Get the attributes for the realm identity.
|
default AuthorizationIdentity |
getAuthorizationIdentity()
Get an authorization identity for this pre-authenticated identity.
|
<C extends Credential> |
getCredential(Class<C> credentialType)
Acquire a credential of the given type.
|
default <C extends Credential> |
getCredential(Class<C> credentialType,
String algorithmName)
Acquire a credential of the given type and algorithm name.
|
default <C extends Credential> |
getCredential(Class<C> credentialType,
String algorithmName,
AlgorithmParameterSpec parameterSpec)
Acquire a credential of the given type and algorithm name.
|
default SupportLevel |
getCredentialAcquireSupport(Class<? extends Credential> credentialType,
String algorithmName)
Deprecated.
Transition method; remove before GA.
|
SupportLevel |
getCredentialAcquireSupport(Class<? extends Credential> credentialType,
String algorithmName,
AlgorithmParameterSpec parameterSpec)
Determine whether a given credential type is definitely obtainable, possibly obtainable, or definitely not
obtainable for this identity.
|
SupportLevel |
getEvidenceVerifySupport(Class<? extends Evidence> evidenceType,
String algorithmName)
Determine whether a given type of evidence is definitely verifiable, possibly verifiable, or definitely not verifiable.
|
Principal |
getRealmIdentityPrincipal()
Get the principal that canonically identifies the identity within the realm.
|
default void |
updateCredential(Credential credential)
Update a credential of this realm identity.
|
boolean |
verifyEvidence(Evidence evidence)
Verify the given evidence against a credential of this identity.
|
static final RealmIdentity ANONYMOUS
static final RealmIdentity NON_EXISTENT
Principal getRealmIdentityPrincipal()
SecurityRealm.getRealmIdentity(Principal)
(a.k.a. domain principal), but
is not required to do so. Any existent realm identity (i.e. any identity which returns true
on invocation
of exists()
) must return a non-null
principal.null
)default SupportLevel getCredentialAcquireSupport(Class<? extends Credential> credentialType, String algorithmName) throws RealmUnavailableException
RealmUnavailableException
SupportLevel getCredentialAcquireSupport(Class<? extends Credential> credentialType, String algorithmName, AlgorithmParameterSpec parameterSpec) throws RealmUnavailableException
credentialType
- the exact credential type (must not be null
)algorithmName
- the algorithm name, or null
if any algorithm is acceptable or the credential type does
not support algorithm namesparameterSpec
- the algorithm parameters to match, or null
if any parameters are acceptable or the credential type
does not support algorithm parametersnull
)RealmUnavailableException
- if the realm is not able to handle requests for any reason<C extends Credential> C getCredential(Class<C> credentialType) throws RealmUnavailableException
C
- the credential typecredentialType
- the credential type class (must not be null
)null
if no such credential existsRealmUnavailableException
- if the realm is not able to handle requests for any reasondefault <C extends Credential> C getCredential(Class<C> credentialType, String algorithmName) throws RealmUnavailableException
C
- the credential typecredentialType
- the credential type class (must not be null
)algorithmName
- the algorithm name, or null
if any algorithm is acceptable or the credential type
does not support algorithm namesnull
if no such credential existsRealmUnavailableException
- if the realm is not able to handle requests for any reasondefault <C extends Credential> C getCredential(Class<C> credentialType, String algorithmName, AlgorithmParameterSpec parameterSpec) throws RealmUnavailableException
C
- the credential typecredentialType
- the credential type class (must not be null
)algorithmName
- the algorithm name, or null
if any algorithm is acceptable or the credential type
does not support algorithm namesparameterSpec
- the algorithm parameters to match, or null
if any parameters are acceptable or the credential type
does not support algorithm parametersnull
if no such credential existsRealmUnavailableException
- if the realm is not able to handle requests for any reasondefault <C extends Credential,R> R applyToCredential(Class<C> credentialType, Function<C,R> function) throws RealmUnavailableException
C
- the credential typeR
- the return typecredentialType
- the credential type class (must not be null
)function
- the function to apply (must not be null
)null
if the criteria are not metRealmUnavailableException
- if the realm is not able to handle requests for any reasondefault <C extends Credential,R> R applyToCredential(Class<C> credentialType, String algorithmName, Function<C,R> function) throws RealmUnavailableException
C
- the credential typeR
- the return typecredentialType
- the credential type class (must not be null
)algorithmName
- the algorithm name, or null
if any algorithm is acceptable or the credential type
does not support algorithm namesfunction
- the function to apply (must not be null
)null
if the criteria are not metRealmUnavailableException
- if the realm is not able to handle requests for any reasondefault <C extends Credential,R> R applyToCredential(Class<C> credentialType, String algorithmName, AlgorithmParameterSpec parameterSpec, Function<C,R> function) throws RealmUnavailableException
C
- the credential typeR
- the return typecredentialType
- the credential type class (must not be null
)algorithmName
- the algorithm name, or null
if any algorithm is acceptable or the credential type
does not support algorithm namesparameterSpec
- the algorithm parameters to match, or null
if any parameters are acceptable or the credential type
does not support algorithm parametersfunction
- the function to apply (must not be null
)null
if the criteria are not metRealmUnavailableException
- if the realm is not able to handle requests for any reasondefault void updateCredential(Credential credential) throws RealmUnavailableException
credential
- the new credential (must not be null
)UnsupportedOperationException
- if the implementing class does not support updating a credentialRealmUnavailableException
- if the realm is not able to handle requests for any reasonSupportLevel getEvidenceVerifySupport(Class<? extends Evidence> evidenceType, String algorithmName) throws RealmUnavailableException
evidenceType
- the type of evidence to be verified (must not be null
)algorithmName
- the algorithm name, or null
if any algorithm is acceptable or the evidence type does
not support algorithm namesRealmUnavailableException
- if the realm is not able to handle requests for any reasonboolean verifyEvidence(Evidence evidence) throws RealmUnavailableException
evidence
- the evidence to verifytrue
if verification was successful, false
otherwiseRealmUnavailableException
- if the realm is not able to handle requests for any reasonboolean exists() throws RealmUnavailableException
false
up until the point it is known that a call to
getAuthorizationIdentity()
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.true
if the identity exists in this realm, false
otherwiseRealmUnavailableException
- if the realm is not able to handle requests for any reasondefault void dispose()
default AuthorizationIdentity getAuthorizationIdentity() throws RealmUnavailableException
null
)IllegalStateException
- if called for an identity that does not existRealmUnavailableException
- if the realm is not able to handle requests for any reasondefault Attributes getAttributes() throws RealmUnavailableException
null
if the implementing class does not support getting attributesRealmUnavailableException
- if accessing the attributes fails for some reasonCopyright © 2020 JBoss by Red Hat. All rights reserved.