Package org.wildfly.security.credential
Interface Credential
- All Superinterfaces:
Cloneable
- All Known Subinterfaces:
AlgorithmCredential,X509CertificateChainCredential
- All Known Implementing Classes:
BearerTokenCredential,GSSKerberosCredential,KeyPairCredential,PasswordCredential,PublicKeyCredential,SecretKeyCredential,SSHCredential,X509CertificateChainPrivateCredential,X509CertificateChainPublicCredential
A credential is a piece of information that can be used to verify or produce evidence.
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptiondefault booleanDetermine whether this credential can, generally speaking, verify the given evidence type.default booleanDetermine 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>
CCast this credential type if the type matches.default <C extends Credential>
CCast 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.clone()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 the given evidence.default booleanDeprecated.
-
Field Details
-
NO_CREDENTIALS
An array with no credentials.
-
-
Method Details
-
canVerify
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
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.useverify(Supplier, Evidence)insteadVerify the given evidence.- Parameters:
evidence- the evidence to verify (must not benull)- Returns:
trueif the evidence is verified,falseotherwise
-
verify
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
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
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
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
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
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
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
-
verify(Supplier, Evidence)instead