Class DigestUtil
java.lang.Object
org.wildfly.security.mechanism.digest.DigestUtil
Common utility functions used by Digest authentication mechanisms.
- Author:
- Darran Lofthouse, Peter Skopek.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic char[]getTwoWayPasswordChars(org.wildfly.security.password.TwoWayPassword password, Supplier<Provider[]> providers, org.wildfly.security.mechanism._private.ElytronMessages log) Get array of password chars from TwoWayPassword.parseResponse(byte[] challenge, Charset charset, boolean multiRealm, org.wildfly.security.mechanism._private.ElytronMessages log) Client side method to parse challenge sent by server.static byte[]userRealmPasswordDigest(MessageDigest messageDigest, String username, String realm, char[] password) Digests the concatenated username, realm and password.
-
Constructor Details
-
DigestUtil
public DigestUtil()
-
-
Method Details
-
parseResponse
public static HashMap<String,byte[]> parseResponse(byte[] challenge, Charset charset, boolean multiRealm, org.wildfly.security.mechanism._private.ElytronMessages log) throws org.wildfly.security.mechanism.AuthenticationMechanismException Client side method to parse challenge sent by server.- Parameters:
challenge- the byte array representing the authentication challenge to be parsed.charset- the charset to decide which whitespace separator is used.multiRealm-trueif there are multiple realms in the challenge,falseotherwiselog- the logger to use.- Returns:
- A new HashMap representing response for the parsed challenge
- Throws:
org.wildfly.security.mechanism.AuthenticationMechanismException- if there is an error parsing the challenge
-
userRealmPasswordDigest
public static byte[] userRealmPasswordDigest(MessageDigest messageDigest, String username, String realm, char[] password) Digests the concatenated username, realm and password.- Parameters:
messageDigest- the message digest algorithm to use when computing the digest.username- the username to use when concatenating.realm- the realm to use when concatenating.password- the password in the form of a char array to use when concatenating.- Returns:
- byte array of the digested password.
-
getTwoWayPasswordChars
public static char[] getTwoWayPasswordChars(org.wildfly.security.password.TwoWayPassword password, Supplier<Provider[]> providers, org.wildfly.security.mechanism._private.ElytronMessages log) throws org.wildfly.security.mechanism.AuthenticationMechanismException Get array of password chars from TwoWayPassword.- Parameters:
password- the TwoWayPassword that needs to be processed.providers- the supplier for the providers to be used for processing.log- the logger to use.- Returns:
- encoded password in the form of a char array.
- Throws:
org.wildfly.security.mechanism.AuthenticationMechanismException- if there is an error retrieving the encoded password.
-