Package org.wildfly.security.credential
Class PasswordCredential
java.lang.Object
org.wildfly.security.credential.PasswordCredential
- All Implemented Interfaces:
Cloneable,AlgorithmCredential,Credential
A credential for password authentication.
-
Field Summary
Fields inherited from interface org.wildfly.security.credential.Credential
NO_CREDENTIALS -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanDetermine whether this credential can, generally speaking, verify the given evidence type.static booleancanVerifyEvidence(Class<? extends Evidence> evidenceClass, String algorithmName) Determine whether this credential type can, generally speaking, verify the given evidence type.clone()Creates and returns a copy of thisCredential.booleanGet the algorithm name associated with this credential (will never benull).<P extends AlgorithmParameterSpec>
PgetParameters(Class<P> paramSpecClass) Get the algorithm parameters of the given type from this credential.Get the password.<P extends Password>
PgetPassword(Class<P> type) Get the password if it is of the given type; otherwise returnnull.inthashCode()booleanimpliesParameters(AlgorithmParameterSpec parameterSpec) Determine whether this credential implies the given parameters.booleanDetermine whether the other credential's parameters are implied by this one.booleansupportsParameters(Class<? extends AlgorithmParameterSpec> paramSpecClass) Determine whether this credential instance supports the given algorithm parameter type.booleanVerify the given evidence.booleanVerify the given evidence.booleanVerify the given evidence.Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.wildfly.security.credential.AlgorithmCredential
getParameters, matches, matches, matches, supportsParametersMethods inherited from interface org.wildfly.security.credential.Credential
canVerify, castAndApply, castAndApply, castAndApply, castAs, castAs, castAs, verify
-
Constructor Details
-
PasswordCredential
Construct a new instance.- Parameters:
password- the password (must not benull)
-
-
Method Details
-
getPassword
Get the password.- Returns:
- the password (not
null)
-
getPassword
Get the password if it is of the given type; otherwise returnnull.- Type Parameters:
P- the password type- Parameters:
type- the password type class- Returns:
- the password, or
nullif the password is not of the given type
-
getAlgorithm
Description copied from interface:AlgorithmCredentialGet the algorithm name associated with this credential (will never benull).- Specified by:
getAlgorithmin interfaceAlgorithmCredential- Returns:
- the algorithm name
-
supportsParameters
Description copied from interface:AlgorithmCredentialDetermine whether this credential instance supports the given algorithm parameter type.- Specified by:
supportsParametersin interfaceAlgorithmCredential- Parameters:
paramSpecClass- the parameter specification class (must not benull)- Returns:
trueif the parameter type is supported,falseotherwise
-
getParameters
Description copied from interface:AlgorithmCredentialGet the algorithm parameters of the given type from this credential.- Specified by:
getParametersin interfaceAlgorithmCredential- Parameters:
paramSpecClass- the parameter specification class (must not benull)- Returns:
- the parameter specification, or
nullif no parameters are present or available or the given type was not supported by this credential
-
impliesParameters
Description copied from interface:AlgorithmCredentialDetermine whether this credential implies the given parameters. The default implementation returnsfalsealways.- Specified by:
impliesParametersin interfaceAlgorithmCredential- Parameters:
parameterSpec- the parameters to test for (must not benull)- Returns:
trueif the given parameters match this credential,falseotherwise
-
impliesSameParameters
Description copied from interface:AlgorithmCredentialDetermine whether the other credential's parameters are implied by this one.- Specified by:
impliesSameParametersin interfaceAlgorithmCredential- Parameters:
other- the other credential (must not benull)- Returns:
trueif the credentials have matching parameters,falseotherwise
-
canVerify
Description copied from interface:CredentialDetermine whether this credential can, generally speaking, verify the given evidence type.- Specified by:
canVerifyin interfaceCredential- 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
-
canVerifyEvidence
public static boolean canVerifyEvidence(Class<? extends Evidence> evidenceClass, String algorithmName) Determine whether this credential type 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
-
verify
Description copied from interface:CredentialVerify the given evidence.- Specified by:
verifyin interfaceCredential- Parameters:
providerSupplier- the provider supplier to use for verification purposesevidence- the evidence to verify (must not benull)- Returns:
trueif the evidence is verified,falseotherwise
-
verify
public boolean verify(Supplier<Provider[]> providerSupplier, 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)hashCharset- the character set to use when converting the password string to a byte array (must not benull)- Returns:
trueif the evidence is verified,falseotherwise
-
verify
Verify the given evidence.- Parameters:
evidence- the evidence to verify (must not benull)hashCharset- the character set to use when converting the password string to a byte array (must not benull)- Returns:
trueif the evidence is verified,falseotherwise
-
clone
Description copied from interface:AlgorithmCredentialCreates and returns a copy of thisCredential.- Specified by:
clonein interfaceAlgorithmCredential- Specified by:
clonein interfaceCredential- Overrides:
clonein classObject- Returns:
- a copy of this
Credential.
-
hashCode
public int hashCode() -
equals
-