Class PasswordDigestObtainer
- java.lang.Object
-
- org.wildfly.security.mechanism.digest.PasswordDigestObtainer
-
public class PasswordDigestObtainer extends Object
Utility class used to obtain username+realm+password using SASL/HTTP mechanism callbacks.- Author:
- Jan Kalina
-
-
Constructor Summary
Constructors Constructor Description 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.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetRealm()Returns the realm obtained from callback or the default one.StringgetUsername()Returns the username obtained from callback or the default one.byte[]handleUserRealmPasswordCallbacks()Handles callbacks for user and password information.
-
-
-
Constructor Detail
-
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 Detail
-
getUsername
public String getUsername()
Returns the username obtained from callback or the default one.- Returns:
- the username obtained from callback or the default one.
-
getRealm
public String getRealm()
Returns the realm obtained from callback or the default one.- Returns:
- the realm obtained from callback or the default one.
-
handleUserRealmPasswordCallbacks
public byte[] handleUserRealmPasswordCallbacks() throws AuthenticationMechanismExceptionHandles callbacks for user and password information.- Returns:
- the salted password.
- Throws:
AuthenticationMechanismException- if the callback handler does not support credential acquisition.
-
-