Class PasswordDigestObtainer
java.lang.Object
org.wildfly.security.mechanism.digest.PasswordDigestObtainer
Utility class used to obtain username+realm+password using SASL/HTTP mechanism callbacks.
- Author:
- Jan Kalina
-
Constructor Summary
ConstructorsConstructorDescriptionPasswordDigestObtainer(CallbackHandler callbackHandler, String defaultUsername, String defaultRealm, ElytronMessages log, String credentialAlgorithm, MessageDigest messageDigest, Supplier<Provider[]> passwordFactoryProviders, String[] realms, boolean readOnlyRealmUsername, boolean skipRealmCallbacks) Constructs a newPasswordDigestObtainerinstance. -
Method Summary
Modifier and TypeMethodDescriptiongetRealm()Returns the realm obtained from callback or the default one.Returns the username obtained from callback or the default one.byte[]Handles callbacks for user and password information.
-
Constructor Details
-
PasswordDigestObtainer
public PasswordDigestObtainer(CallbackHandler callbackHandler, String defaultUsername, String defaultRealm, ElytronMessages log, String credentialAlgorithm, MessageDigest messageDigest, Supplier<Provider[]> passwordFactoryProviders, String[] realms, boolean readOnlyRealmUsername, boolean skipRealmCallbacks) Constructs a newPasswordDigestObtainerinstance.- Parameters:
callbackHandler- the callbackHandler to handle the callbacks required to obtain the username and password.defaultUsername- the default username to use if a callback is not provided.defaultRealm- the default realm to use if a callback is not provided.log- the logger to use.credentialAlgorithm- the name of the algorithm for obtaining the credential.messageDigest- theMessageDigestused for digesting the password.passwordFactoryProviders- the supplier of the providers to use when creating aPasswordFactoryinstance.realms- the realms to check for a user and password.readOnlyRealmUsername-trueif the username passed in the callback can be modified,falseotherwise.skipRealmCallbacks-trueif realm callbacks should be skipped,falseotherwise.
-
-
Method Details
-
getUsername
Returns the username obtained from callback or the default one.- Returns:
- the username obtained from callback or the default one.
-
getRealm
Returns the realm obtained from callback or the default one.- Returns:
- the realm obtained from callback or the default one.
-
handleUserRealmPasswordCallbacks
Handles callbacks for user and password information.- Returns:
- the salted password, never
null. - Throws:
AuthenticationMechanismException- if the callback handler does not support credential acquisition.
-