Package org.wildfly.security.credential
Interface Credential
-
- All Superinterfaces:
Cloneable
- All Known Subinterfaces:
AlgorithmCredential,X509CertificateChainCredential
- All Known Implementing Classes:
AbstractX509CertificateChainCredential,BearerTokenCredential,GSSKerberosCredential,KeyPairCredential,PasswordCredential,PublicKeyCredential,SecretKeyCredential,SSHCredential,X509CertificateChainPrivateCredential,X509CertificateChainPublicCredential
public interface Credential extends Cloneable
A credential is a piece of information that can be used to verify or produce evidence.
-
-
Field Summary
Fields Modifier and Type Field Description static Credential[]NO_CREDENTIALSAn array with no credentials.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Deprecated Methods Modifier and Type Method Description default booleancanVerify(Class<? extends Evidence> evidenceClass, String algorithmName)Determine whether this credential can, generally speaking, verify the given evidence type.default booleancanVerify(Evidence evidence)Determine whether this credential can verify the given evidence.default <C extends Credential,R>
RcastAndApply(Class<C> credentialType, String algorithmName, AlgorithmParameterSpec parameterSpec, Function<C,R> function)Cast this credential type and apply a function if the type matches.default <C extends Credential,R>
RcastAndApply(Class<C> credentialType, String algorithmName, Function<C,R> function)Cast this credential type and apply a function if the type matches.default <C extends Credential,R>
RcastAndApply(Class<C> credentialType, Function<C,R> function)Cast this credential type and apply a function if the type matches.default <C extends Credential>
CcastAs(Class<C> credentialType)Cast this credential type if the type matches.default <C extends Credential>
CcastAs(Class<C> credentialType, String algorithmName)Cast this credential type if the type and algorithm matches.default <C extends Credential>
CcastAs(Class<C> credentialType, String algorithmName, AlgorithmParameterSpec parameterSpec)Cast this credential type if the type, algorithm, and parameters match.Credentialclone()Creates and returns a copy of thisCredential.static CredentialfromKeyStoreEntry(KeyStore.Entry keyStoreEntry)Convert a key store entry into a credential object.default booleanmatches(Class<? extends Credential> credentialType, String algorithmName, AlgorithmParameterSpec parameterSpec)Determine if this credential matches the given criteria.default booleanmatches(AlgorithmCredential other)Determine if this credential is the same kind of credential as the given credential.default booleanmatches(Credential other)Determine if this credential is the same kind of credential as the given credential.default booleanverify(Supplier<Provider[]> providerSupplier, Evidence evidence)Verify the given evidence.default booleanverify(Evidence evidence)Deprecated.useverify(Supplier, Evidence)instead
-
-
-
Field Detail
-
NO_CREDENTIALS
static final Credential[] NO_CREDENTIALS
An array with no credentials.
-
-
Method Detail
-
canVerify
default boolean canVerify(Class<? extends Evidence> evidenceClass, String algorithmName)
Determine whether this credential can, generally speaking, verify the given evidence type.- Parameters:
evidenceClass- the evidence type (must not benull)algorithmName- the evidence algorithm name (may benullif the type of evidence does not support algorithm names)- Returns:
trueif the evidence can be verified by this credential,falseotherwise
-
canVerify
default boolean canVerify(Evidence evidence)
Determine whether this credential can verify the given evidence.- Parameters:
evidence- the evidence (must not benull)- Returns:
trueif the evidence can be verified by this credential,falseotherwise
-
verify
@Deprecated default boolean verify(Evidence evidence)
Deprecated.useverify(Supplier, Evidence)insteadVerify the given evidence.- Parameters:
evidence- the evidence to verify (must not benull)- Returns:
trueif the evidence is verified,falseotherwise
-
verify
default boolean verify(Supplier<Provider[]> providerSupplier, Evidence evidence)
Verify the given evidence.- Parameters:
providerSupplier- the provider supplier to use for verification purposesevidence- the evidence to verify (must not benull)- Returns:
trueif the evidence is verified,falseotherwise
-
castAs
default <C extends Credential> C castAs(Class<C> credentialType, String algorithmName, AlgorithmParameterSpec parameterSpec)
Cast this credential type if the type, algorithm, and parameters match.- Type Parameters:
C- the credential type- Parameters:
credentialType- the credential type class to checkalgorithmName- the name of the algorithm ornullif any algorithm is acceptableparameterSpec- the parameter specification ornullif any parameter specification is acceptable- Returns:
- the credential cast as the target type, or
nullif the credential does not match the criteria
-
castAs
default <C extends Credential> C castAs(Class<C> credentialType, String algorithmName)
Cast this credential type if the type and algorithm matches.- Type Parameters:
C- the credential type- Parameters:
credentialType- the credential type class to checkalgorithmName- the name of the algorithm ornullif any algorithm is acceptable- Returns:
- the credential cast as the target type, or
nullif the credential does not match the criteria
-
castAs
default <C extends Credential> C castAs(Class<C> credentialType)
Cast this credential type if the type matches.- Type Parameters:
C- the credential type- Parameters:
credentialType- the credential type class to check- Returns:
- the credential cast as the target type, or
nullif the credential does not match the criteria
-
castAndApply
default <C extends Credential,R> R castAndApply(Class<C> credentialType, String algorithmName, AlgorithmParameterSpec parameterSpec, Function<C,R> function)
Cast this credential type and apply a function if the type matches.- Type Parameters:
C- the credential typeR- the return type- Parameters:
credentialType- the credential type class to checkalgorithmName- the name of the algorithm ornullif any algorithm is acceptableparameterSpec- the parameter specification ornullif any parameter specification is acceptablefunction- the function to apply- Returns:
- the result of the function, or
nullif the credential is not of the given type
-
castAndApply
default <C extends Credential,R> R castAndApply(Class<C> credentialType, String algorithmName, Function<C,R> function)
Cast this credential type and apply a function if the type matches.- Type Parameters:
C- the credential typeR- the return type- Parameters:
credentialType- the credential type class to checkalgorithmName- the name of the algorithm ornullif any algorithm is acceptablefunction- the function to apply- Returns:
- the result of the function, or
nullif the credential is not of the given type
-
castAndApply
default <C extends Credential,R> R castAndApply(Class<C> credentialType, Function<C,R> function)
Cast this credential type and apply a function if the type matches.- Type Parameters:
C- the credential typeR- the return type- Parameters:
credentialType- the credential type class to checkfunction- the function to apply- Returns:
- the result of the function, or
nullif the credential is not of the given type
-
clone
Credential clone()
Creates and returns a copy of thisCredential.- Returns:
- a copy of this
Credential.
-
matches
default boolean matches(Credential other)
Determine if this credential is the same kind of credential as the given credential.- Parameters:
other- the other credential- Returns:
trueif the credentials are of the same kind,falseotherwise
-
matches
default boolean matches(AlgorithmCredential other)
Determine if this credential is the same kind of credential as the given credential.- Parameters:
other- the other credential- Returns:
trueif the credentials are of the same kind,falseotherwise
-
matches
default boolean matches(Class<? extends Credential> credentialType, String algorithmName, AlgorithmParameterSpec parameterSpec)
Determine if this credential matches the given criteria.- Parameters:
credentialType- the credential type class to checkalgorithmName- the name of the algorithm ornullif any algorithm is acceptableparameterSpec- the parameter specification ornullif any parameter specification is acceptable- Returns:
trueif the credential matches the specification,falseotherwise
-
fromKeyStoreEntry
static Credential fromKeyStoreEntry(KeyStore.Entry keyStoreEntry)
Convert a key store entry into a credential object.- Parameters:
keyStoreEntry- the key store entry to convert (must not benull)- Returns:
- the corresponding credential, or
nullif the entry type is unrecognized
-
-