Package org.apache.catalina.realm
Class JAASCallbackHandler
- java.lang.Object
-
- org.apache.catalina.realm.JAASCallbackHandler
-
- All Implemented Interfaces:
CallbackHandler
public class JAASCallbackHandler extends Object implements CallbackHandler
Implementation of the JAAS
CallbackHandlerinterface, used to negotiate delivery of the username and credentials that were specified to our constructor. No interaction with the user is required (or possible).This
CallbackHandlerwill pre-digest the supplied password, if required by the<Realm>element inserver.xml.At present,
JAASCallbackHandlerknows how to handle callbacks of typejavax.security.auth.callback.NameCallbackandjavax.security.auth.callback.PasswordCallback.- Author:
- Craig R. McClanahan, Andrew R. Jaquith
-
-
Field Summary
Fields Modifier and Type Field Description protected StringauthMethodThe authentication method to be used.protected StringcnonceClient generated nonce.protected Stringmd5a2Second MD5 digest.protected StringncNonce count.protected StringnonceServer generated nonce.protected StringpasswordThe password to be authenticated with.protected StringqopQuality of protection applied to the message.protected JAASRealmrealmThe associatedJAASRealminstance.protected StringrealmNameRealm name.protected static StringManagersmThe string manager for this package.protected StringusernameThe username to be authenticated with.
-
Constructor Summary
Constructors Constructor Description JAASCallbackHandler(JAASRealm realm, String username, String password)Construct a callback handler configured with the specified values.JAASCallbackHandler(JAASRealm realm, String username, String password, String nonce, String nc, String cnonce, String qop, String realmName, String md5a2, String authMethod)Construct a callback handler for DIGEST authentication.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidhandle(Callback[] callbacks)Retrieve the information requested in the providedCallbacks.
-
-
-
Field Detail
-
sm
protected static final StringManager sm
The string manager for this package.
-
password
protected final String password
The password to be authenticated with.
-
realm
protected final JAASRealm realm
The associatedJAASRealminstance.
-
username
protected final String username
The username to be authenticated with.
-
nonce
protected final String nonce
Server generated nonce.
-
nc
protected final String nc
Nonce count.
-
cnonce
protected final String cnonce
Client generated nonce.
-
qop
protected final String qop
Quality of protection applied to the message.
-
realmName
protected final String realmName
Realm name.
-
md5a2
protected final String md5a2
Second MD5 digest.
-
authMethod
protected final String authMethod
The authentication method to be used. If null, assume BASIC/FORM.
-
-
Constructor Detail
-
JAASCallbackHandler
public JAASCallbackHandler(JAASRealm realm, String username, String password)
Construct a callback handler configured with the specified values. Note that if theJAASRealminstance specifies digested passwords, thepasswordparameter will be pre-digested here.- Parameters:
realm- Our associated JAASRealm instanceusername- Username to be authenticated withpassword- Password to be authenticated with
-
JAASCallbackHandler
public JAASCallbackHandler(JAASRealm realm, String username, String password, String nonce, String nc, String cnonce, String qop, String realmName, String md5a2, String authMethod)
Construct a callback handler for DIGEST authentication.- Parameters:
realm- Our associated JAASRealm instanceusername- Username to be authenticated withpassword- Password to be authenticated withnonce- Server generated noncenc- Nonce countcnonce- Client generated nonceqop- Quality of protection applied to the messagerealmName- Realm namemd5a2- Second MD5 digest used to calculate the digest MD5(Method + ":" + uri)authMethod- The authentication method in use
-
-
Method Detail
-
handle
public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException
Retrieve the information requested in the providedCallbacks. This implementation only recognizesNameCallback,PasswordCallbackandTextInputCallback.TextInputCallbackis used to pass the various additional parameters required for DIGEST authentication.- Specified by:
handlein interfaceCallbackHandler- Parameters:
callbacks- The set ofCallbacks to be processed- Throws:
IOException- if an input/output error occursUnsupportedCallbackException- if the login method requests an unsupported callback type
-
-