Class IdentityCredentials
java.lang.Object
org.wildfly.security.auth.server.IdentityCredentials
- All Implemented Interfaces:
Iterable<org.wildfly.security.credential.Credential>, CredentialSource
public abstract class IdentityCredentials
extends Object
implements Iterable<org.wildfly.security.credential.Credential>, CredentialSource
The public or private credentials retained by an identity, which can be used for authentication forwarding. This
credentials set can contain zero or one credential of a given type and algorithm name. If the credential type
does not support algorithm names, then the set can contain zero or one credential of that type. The credential
set may be iterated; iteration order is not prescribed and may change if the implementation is changed.
- Author:
- David M. Lloyd
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescription<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 and algorithm.final <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.final <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.booleancanVerify(Class<? extends org.wildfly.security.evidence.Evidence> evidenceClass, String algorithmName) Test whether some of the credentials in this set can verify an evidence of given class and algorithm name.booleancanVerify(org.wildfly.security.evidence.Evidence evidence) Test whether some of the credentials in this set can verify an evidence.final booleanDetermine whether a credential of the given type is present in this set.final booleancontains(Class<? extends org.wildfly.security.credential.Credential> credentialType, String algorithmName) Determine whether a credential of the given type and algorithm are present in this set.abstract booleancontains(Class<? extends org.wildfly.security.credential.Credential> credentialType, String algorithmName, AlgorithmParameterSpec parameterSpec) Determine whether a credential of the given type and algorithm are present in this set.final booleancontainsMatching(org.wildfly.security.credential.Credential credential) Determine whether a credential of the type, algorithm, and parameters of the given credential is present in this set.final <C extends org.wildfly.security.credential.Credential>
CgetCredential(Class<C> credentialType) Acquire a credential of the given type.final <C extends org.wildfly.security.credential.Credential>
CgetCredential(Class<C> credentialType, String algorithmName) Acquire a credential of the given type and algorithm name.abstract <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.final org.wildfly.security.auth.SupportLevelgetCredentialAcquireSupport(Class<? extends org.wildfly.security.credential.Credential> credentialType) Determine whether a given credential is definitely obtainable, possibly obtainable, or definitely not obtainable.final org.wildfly.security.auth.SupportLevelgetCredentialAcquireSupport(Class<? extends org.wildfly.security.credential.Credential> credentialType, String algorithmName) Determine whether a given credential is definitely obtainable, possibly obtainable, or definitely not obtainable.final org.wildfly.security.auth.SupportLevelgetCredentialAcquireSupport(Class<? extends org.wildfly.security.credential.Credential> credentialType, String algorithmName, AlgorithmParameterSpec parameterSpec) Determine whether a given credential is definitely obtainable, possibly obtainable, or definitely not obtainable.abstract intsize()Get the size of this credential set.Spliterator<org.wildfly.security.credential.Credential> Get aSpliteratorfor this credential set.booleanVerify the given evidence.booleanverify(Supplier<Provider[]> providerSupplier, org.wildfly.security.evidence.Evidence evidence, Charset hashCharset) Verify the given evidence.booleanverify(org.wildfly.security.evidence.Evidence evidence) Verify the given evidence.booleanDeprecated.abstract IdentityCredentialswith(IdentityCredentials other) Return a copy of this credential set with the given credential set added to it.abstract IdentityCredentialswithCredential(org.wildfly.security.credential.Credential credential) Return a copy of this credential set, but with the given credential added to it.final IdentityCredentialsReturn a copy of this credential set without any credentials of the given type.final IdentityCredentialswithout(Class<? extends org.wildfly.security.credential.Credential> credentialType, String algorithmName) Return a copy of this credential set without any credentials of the given type and algorithm name.without(Class<? extends org.wildfly.security.credential.Credential> credentialType, String algorithmName, AlgorithmParameterSpec parameterSpec) Return a copy of this credential set without any credentials of the given type, algorithm name and parameter spec.final <C extends org.wildfly.security.credential.Credential>
IdentityCredentialsReturn a copy of this credential set without any credentials of the given type that match the predicate.abstract IdentityCredentialsReturn a copy of this credential set without any credentials that match the predicate.withoutMatching(org.wildfly.security.credential.Credential credential) Return a copy of this credential set without any credentials with a type, algorithm name, and parameters matching that of the given credential.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface CredentialSource
with
-
Field Details
-
NONE
The empty credentials object.
-
-
Method Details
-
contains
public final boolean contains(Class<? extends org.wildfly.security.credential.Credential> credentialType) Determine whether a credential of the given type is present in this set.- Parameters:
credentialType- the credential type class (must not benull)- Returns:
trueif a matching credential is contained in this set,falseotherwise
-
getCredentialAcquireSupport
public final org.wildfly.security.auth.SupportLevel getCredentialAcquireSupport(Class<? extends org.wildfly.security.credential.Credential> credentialType, String algorithmName, AlgorithmParameterSpec parameterSpec) Description copied from interface:CredentialSourceDetermine whether a given credential is definitely obtainable, possibly obtainable, or definitely not obtainable.- Specified by:
getCredentialAcquireSupportin interfaceCredentialSource- 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 level of support for this credential type (not
null)
-
getCredentialAcquireSupport
public final org.wildfly.security.auth.SupportLevel getCredentialAcquireSupport(Class<? extends org.wildfly.security.credential.Credential> credentialType, String algorithmName) Description copied from interface:CredentialSourceDetermine whether a given credential is definitely obtainable, possibly obtainable, or definitely not obtainable.- Specified by:
getCredentialAcquireSupportin interfaceCredentialSource- 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 level of support for this credential type (not
null)
-
getCredentialAcquireSupport
public final org.wildfly.security.auth.SupportLevel getCredentialAcquireSupport(Class<? extends org.wildfly.security.credential.Credential> credentialType) Description copied from interface:CredentialSourceDetermine whether a given credential is definitely obtainable, possibly obtainable, or definitely not obtainable.- Specified by:
getCredentialAcquireSupportin interfaceCredentialSource- Parameters:
credentialType- the credential type class (must not benull)- Returns:
- the level of support for this credential type (not
null)
-
contains
public abstract boolean contains(Class<? extends org.wildfly.security.credential.Credential> credentialType, String algorithmName, AlgorithmParameterSpec parameterSpec) Determine whether a credential of the given type and algorithm are present in this set.- 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 parameter specification ornullif any parameter specification is acceptable- Returns:
trueif a matching credential is contained in this set,falseotherwise
-
contains
public final boolean contains(Class<? extends org.wildfly.security.credential.Credential> credentialType, String algorithmName) Determine whether a credential of the given type and algorithm are present in this set.- 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:
trueif a matching credential is contained in this set,falseotherwise
-
containsMatching
public final boolean containsMatching(org.wildfly.security.credential.Credential credential) Determine whether a credential of the type, algorithm, and parameters of the given credential is present in this set.- Parameters:
credential- the credential to check against (must not benull)- Returns:
trueif a matching credential is contained in this set,falseotherwise
-
getCredential
public final <C extends org.wildfly.security.credential.Credential> C getCredential(Class<C> credentialType) Acquire a credential of the given type.- Specified by:
getCredentialin interfaceCredentialSource- Type Parameters:
C- the credential type- Parameters:
credentialType- the credential type class (must not benull)- Returns:
- the credential, or
nullif no such credential exists
-
getCredential
public final <C extends org.wildfly.security.credential.Credential> C getCredential(Class<C> credentialType, String algorithmName) Acquire a credential of the given type and algorithm name.- Specified by:
getCredentialin interfaceCredentialSource- 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
-
getCredential
public abstract <C extends org.wildfly.security.credential.Credential> C getCredential(Class<C> credentialType, String algorithmName, AlgorithmParameterSpec parameterSpec) Acquire a credential of the given type and algorithm name.- Specified by:
getCredentialin interfaceCredentialSource- 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 parameter specification ornullif any parameter specification is acceptable- Returns:
- the credential, or
nullif no such credential exists
-
applyToCredential
public final <C extends org.wildfly.security.credential.Credential, R> 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.- Specified by:
applyToCredentialin interfaceCredentialSource- 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
-
applyToCredential
public final <C extends org.wildfly.security.credential.Credential, R> 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.- Specified by:
applyToCredentialin interfaceCredentialSource- Type Parameters:
C- the credential typeR- the return type- Parameters:
credentialType- the credential type class (must not benull)algorithmName- the algorithm namefunction- the function to apply (must not benull)- Returns:
- the result of the function, or
nullif the criteria are not met
-
applyToCredential
public <C extends org.wildfly.security.credential.Credential, R> 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 and algorithm.- Specified by:
applyToCredentialin interfaceCredentialSource- Type Parameters:
C- the credential typeR- the return type- Parameters:
credentialType- the credential type class (must not benull)algorithmName- the algorithm nameparameterSpec- the parameter specification ornullif any parameter specification is acceptablefunction- the function to apply (must not benull)- Returns:
- the result of the function, or
nullif the criteria are not met
-
withCredential
public abstract IdentityCredentials withCredential(org.wildfly.security.credential.Credential credential) Return a copy of this credential set, but with the given credential added to it.- Parameters:
credential- the credential to append (must not benull)- Returns:
- the new credential set (not
null)
-
with
Return a copy of this credential set with the given credential set added to it.- Parameters:
other- the credential set to append (must not benull)- Returns:
- the new credential set (not
null)
-
withoutMatching
Return a copy of this credential set without any credentials with a type, algorithm name, and parameters matching that of the given credential. If the credential type, algorithm name, and parameters are not found in this set, return this instance.- Parameters:
credential- the credential to match against (must not benull)- Returns:
- the new credential set (not
null)
-
without
public final IdentityCredentials without(Class<? extends org.wildfly.security.credential.Credential> credentialType) Return a copy of this credential set without any credentials of the given type. If the credential type is not found in this set, return this instance.- Specified by:
withoutin interfaceCredentialSource- Parameters:
credentialType- the credential type to remove (must not benull)- Returns:
- the new credential set (not
null)
-
without
public final IdentityCredentials without(Class<? extends org.wildfly.security.credential.Credential> credentialType, String algorithmName) Return a copy of this credential set without any credentials of the given type and algorithm name. If the credential type and algorithm name is not found in this set, return this instance.- Specified by:
withoutin interfaceCredentialSource- Parameters:
credentialType- the credential type to remove (must not benull)algorithmName- the algorithm name to remove, ornullto match any algorithm name- Returns:
- the new credential set (not
null)
-
without
public IdentityCredentials without(Class<? extends org.wildfly.security.credential.Credential> credentialType, String algorithmName, AlgorithmParameterSpec parameterSpec) Return a copy of this credential set without any credentials of the given type, algorithm name and parameter spec. If the credential type and algorithm name is not found in this set, return this instance.- Specified by:
withoutin interfaceCredentialSource- Parameters:
credentialType- the credential type to remove (must not benull)algorithmName- the algorithm name to remove, ornullto match any algorithm nameparameterSpec- the parameter spec to remove, ornullto match any parameter spec- Returns:
- the new credential set (not
null)
-
without
public abstract IdentityCredentials without(Predicate<? super org.wildfly.security.credential.Credential> predicate) Return a copy of this credential set without any credentials that match the predicate. If no credentials match the predicate, return this instance.- Parameters:
predicate- the predicate to test (must not benull)- Returns:
- the new credential set (not
null)
-
without
public final <C extends org.wildfly.security.credential.Credential> IdentityCredentials without(Class<C> credentialType, Predicate<? super C> predicate) Return a copy of this credential set without any credentials of the given type that match the predicate. If no credentials match the predicate, return this instance.- Type Parameters:
C- the credential type- Parameters:
credentialType- the credential type classpredicate- the predicate to test (must not benull)- Returns:
- the new credential set (not
null)
-
spliterator
Get aSpliteratorfor this credential set.- Specified by:
spliteratorin interfaceIterable<org.wildfly.security.credential.Credential>- Returns:
- the spliterator (not
null)
-
canVerify
public boolean canVerify(Class<? extends org.wildfly.security.evidence.Evidence> evidenceClass, String algorithmName) Test whether some of the credentials in this set can verify an evidence of given class and algorithm name.- Parameters:
evidenceClass- the class of the evidence (must not benull)algorithmName- the algorithm name (may benullif the type of evidence does not support algorithm names)- Returns:
trueif the evidence can be verified
-
canVerify
public boolean canVerify(org.wildfly.security.evidence.Evidence evidence) Test whether some of the credentials in this set can verify an evidence.- Parameters:
evidence- the evidence (must not benull)- Returns:
trueif the evidence can be verified
-
verify
public boolean verify(org.wildfly.security.evidence.Evidence evidence) Verify the given evidence.- Parameters:
evidence- the evidence to verify (must not benull)- Returns:
trueif the evidence is verified,falseotherwise
-
verify
public boolean verify(Supplier<Provider[]> providerSupplier, org.wildfly.security.evidence.Evidence evidence) Verify the given evidence.- Parameters:
providerSupplier- the provider supplier to use for verification purposes (must not benull)evidence- the evidence to verify (must not benull)- Returns:
trueif the evidence is verified,falseotherwise
-
verify
@Deprecated public boolean verify(org.wildfly.security.evidence.Evidence evidence, Charset hashCharset) Deprecated.useverify(Supplier, Evidence, Charset)insteadVerify the given evidence.- Parameters:
evidence- the evidence to verify (must not benull)- Returns:
trueif the evidence is verified,falseotherwise
-
verify
public boolean verify(Supplier<Provider[]> providerSupplier, org.wildfly.security.evidence.Evidence evidence, Charset hashCharset) Verify the given evidence.- Parameters:
providerSupplier- the provider supplier to use for verification purposes (must not benull)evidence- the evidence to verify (must not benull)- Returns:
trueif the evidence is verified,falseotherwise
-
size
public abstract int size()Get the size of this credential set.- Returns:
- the size of this credential set
-
verify(Supplier, Evidence, Charset)instead