Package org.wildfly.security.password
Interface Password
-
- All Superinterfaces:
Cloneable,Key,Serializable
- All Known Subinterfaces:
BCryptPassword,BSDUnixDESCryptPassword,ClearPassword,DigestPassword,MaskedPassword,OneTimePassword,OneWayPassword,SaltedSimpleDigestPassword,ScramDigestPassword,SimpleDigestPassword,SunUnixMD5CryptPassword,TwoWayPassword,UnixDESCryptPassword,UnixMD5CryptPassword,UnixSHACryptPassword
public interface Password extends Key, Cloneable
A password key.- Author:
- David M. Lloyd
-
-
Field Summary
-
Fields inherited from interface java.security.Key
serialVersionUID
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default <P extends Password,R>
RcastAndApply(Class<P> passwordType, String algorithmName, Function<P,R> function)Cast this password type and apply a function if the type matches.default <P extends Password,R>
RcastAndApply(Class<P> passwordType, Function<P,R> function)Cast this password type and apply a function if the type matches.default <P extends Password>
PcastAs(Class<P> passwordType)Cast this password type if the type matches.default <P extends Password>
PcastAs(Class<P> passwordType, String algorithmName)Cast this password type if the type and algorithm matches.Passwordclone()Creates and returns a copy of thisPassword.default AlgorithmParameterSpecgetParameterSpec()Get the applicable algorithm parameter specification for this password type.default booleanimpliesParameters(AlgorithmParameterSpec parameterSpec)Determine if this password is matched by the given parameter specification.-
Methods inherited from interface java.security.Key
getAlgorithm, getEncoded, getFormat
-
-
-
-
Method Detail
-
castAs
default <P extends Password> P castAs(Class<P> passwordType, String algorithmName)
Cast this password type if the type and algorithm matches.- Type Parameters:
P- the password type- Parameters:
passwordType- the password type class to checkalgorithmName- the name of the algorithm ornullif any algorithm is acceptable- Returns:
- the password cast as the target type, or
nullif the password does not match the criteria
-
castAs
default <P extends Password> P castAs(Class<P> passwordType)
Cast this password type if the type matches.- Type Parameters:
P- the password type- Parameters:
passwordType- the password type class to check- Returns:
- the password cast as the target type, or
nullif the password does not match the criteria
-
castAndApply
default <P extends Password,R> R castAndApply(Class<P> passwordType, String algorithmName, Function<P,R> function)
Cast this password type and apply a function if the type matches.- Type Parameters:
P- the password typeR- the return type- Parameters:
passwordType- the password 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 password is not of the given type
-
castAndApply
default <P extends Password,R> R castAndApply(Class<P> passwordType, Function<P,R> function)
Cast this password type and apply a function if the type matches.- Type Parameters:
P- the password typeR- the return type- Parameters:
passwordType- the password type class to checkfunction- the function to apply- Returns:
- the result of the function, or
nullif the password is not of the given type
-
getParameterSpec
default AlgorithmParameterSpec getParameterSpec()
Get the applicable algorithm parameter specification for this password type.- Returns:
- the algorithm parameter specification, or
nullif this password type does not support algorithms
-
impliesParameters
default boolean impliesParameters(AlgorithmParameterSpec parameterSpec)
Determine if this password is matched by the given parameter specification.- Parameters:
parameterSpec- the parameter specification (must not benull)- Returns:
trueif the password is matched by the parameters,falseotherwise
-
-