Package org.wildfly.security.credential
Class PasswordCredential
- java.lang.Object
-
- org.wildfly.security.credential.PasswordCredential
-
- All Implemented Interfaces:
Cloneable
,AlgorithmCredential
,Credential
public final class PasswordCredential extends Object implements AlgorithmCredential
A credential for password authentication.
-
-
Field Summary
-
Fields inherited from interface org.wildfly.security.credential.Credential
NO_CREDENTIALS
-
-
Constructor Summary
Constructors Constructor Description PasswordCredential(Password password)
Construct a new instance.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
canVerify(Class<? extends Evidence> evidenceClass, String algorithmName)
Determine whether this credential can, generally speaking, verify the given evidence type.static boolean
canVerifyEvidence(Class<? extends Evidence> evidenceClass, String algorithmName)
Determine whether this credential type can, generally speaking, verify the given evidence type.PasswordCredential
clone()
Creates and returns a copy of thisCredential
.boolean
equals(Object obj)
String
getAlgorithm()
Get 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.Password
getPassword()
Get the password.<P extends Password>
PgetPassword(Class<P> type)
Get the password if it is of the given type; otherwise returnnull
.int
hashCode()
boolean
impliesParameters(AlgorithmParameterSpec parameterSpec)
Determine whether this credential implies the given parameters.boolean
impliesSameParameters(AlgorithmCredential other)
Determine whether the other credential's parameters are implied by this one.boolean
supportsParameters(Class<? extends AlgorithmParameterSpec> paramSpecClass)
Determine whether this credential instance supports the given algorithm parameter type.boolean
verify(Supplier<Provider[]> providerSupplier, Evidence evidence)
Verify the given evidence.-
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.wildfly.security.credential.AlgorithmCredential
getParameters, matches, matches, matches, supportsParameters
-
Methods inherited from interface org.wildfly.security.credential.Credential
canVerify, castAndApply, castAndApply, castAndApply, castAs, castAs, castAs, verify
-
-
-
-
Constructor Detail
-
PasswordCredential
public PasswordCredential(Password password)
Construct a new instance.- Parameters:
password
- the password (must not benull
)
-
-
Method Detail
-
getPassword
public Password getPassword()
Get the password.- Returns:
- the password (not
null
)
-
getPassword
public <P extends Password> P getPassword(Class<P> type)
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
null
if the password is not of the given type
-
getAlgorithm
public String getAlgorithm()
Description copied from interface:AlgorithmCredential
Get the algorithm name associated with this credential (will never benull
).- Specified by:
getAlgorithm
in interfaceAlgorithmCredential
- Returns:
- the algorithm name
-
supportsParameters
public boolean supportsParameters(Class<? extends AlgorithmParameterSpec> paramSpecClass)
Description copied from interface:AlgorithmCredential
Determine whether this credential instance supports the given algorithm parameter type.- Specified by:
supportsParameters
in interfaceAlgorithmCredential
- Parameters:
paramSpecClass
- the parameter specification class (must not benull
)- Returns:
true
if the parameter type is supported,false
otherwise
-
getParameters
public <P extends AlgorithmParameterSpec> P getParameters(Class<P> paramSpecClass)
Description copied from interface:AlgorithmCredential
Get the algorithm parameters of the given type from this credential.- Specified by:
getParameters
in interfaceAlgorithmCredential
- Parameters:
paramSpecClass
- the parameter specification class (must not benull
)- Returns:
- the parameter specification, or
null
if no parameters are present or available or the given type was not supported by this credential
-
impliesParameters
public boolean impliesParameters(AlgorithmParameterSpec parameterSpec)
Description copied from interface:AlgorithmCredential
Determine whether this credential implies the given parameters. The default implementation returnsfalse
always.- Specified by:
impliesParameters
in interfaceAlgorithmCredential
- Parameters:
parameterSpec
- the parameters to test for (must not benull
)- Returns:
true
if the given parameters match this credential,false
otherwise
-
impliesSameParameters
public boolean impliesSameParameters(AlgorithmCredential other)
Description copied from interface:AlgorithmCredential
Determine whether the other credential's parameters are implied by this one.- Specified by:
impliesSameParameters
in interfaceAlgorithmCredential
- Parameters:
other
- the other credential (must not benull
)- Returns:
true
if the credentials have matching parameters,false
otherwise
-
canVerify
public boolean canVerify(Class<? extends Evidence> evidenceClass, String algorithmName)
Description copied from interface:Credential
Determine whether this credential can, generally speaking, verify the given evidence type.- Specified by:
canVerify
in interfaceCredential
- Parameters:
evidenceClass
- the evidence type (must not benull
)algorithmName
- the evidence algorithm name (may benull
if the type of evidence does not support algorithm names)- Returns:
true
if the evidence can be verified by this credential,false
otherwise
-
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 benull
if the type of evidence does not support algorithm names)- Returns:
true
if the evidence can be verified by this credential,false
otherwise
-
verify
public boolean verify(Supplier<Provider[]> providerSupplier, Evidence evidence)
Description copied from interface:Credential
Verify the given evidence.- Specified by:
verify
in interfaceCredential
- Parameters:
providerSupplier
- the provider supplier to use for verification purposesevidence
- the evidence to verify (must not benull
)- Returns:
true
if the evidence is verified,false
otherwise
-
clone
public PasswordCredential clone()
Description copied from interface:AlgorithmCredential
Creates and returns a copy of thisCredential
.- Specified by:
clone
in interfaceAlgorithmCredential
- Specified by:
clone
in interfaceCredential
- Overrides:
clone
in classObject
- Returns:
- a copy of this
Credential
.
-
-