Package org.apache.catalina.realm
Class JAASCallbackHandler
- java.lang.Object
- 
- org.apache.catalina.realm.JAASCallbackHandler
 
- 
- All Implemented Interfaces:
- javax.security.auth.callback.CallbackHandler
 
 public class JAASCallbackHandler extends java.lang.Object implements javax.security.auth.callback.CallbackHandlerImplementation 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 SummaryFields Modifier and Type Field Description protected java.lang.StringauthMethodThe authentication method to be used.protected java.lang.StringcnonceClient generated nonce.protected java.lang.Stringmd5a2Second MD5 digest.protected java.lang.StringncNonce count.protected java.lang.StringnonceServer generated nonce.protected java.lang.StringpasswordThe password to be authenticated with.protected java.lang.StringqopQuality of protection applied to the message.protected JAASRealmrealmThe associatedJAASRealminstance.protected java.lang.StringrealmNameRealm name.protected static StringManagersmThe string manager for this package.protected java.lang.StringusernameThe username to be authenticated with.
 - 
Constructor SummaryConstructors Constructor Description JAASCallbackHandler(JAASRealm realm, java.lang.String username, java.lang.String password)Construct a callback handler configured with the specified values.JAASCallbackHandler(JAASRealm realm, java.lang.String username, java.lang.String password, java.lang.String nonce, java.lang.String nc, java.lang.String cnonce, java.lang.String qop, java.lang.String realmName, java.lang.String md5a2, java.lang.String authMethod)Construct a callback handler for DIGEST authentication.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description voidhandle(javax.security.auth.callback.Callback[] callbacks)Retrieve the information requested in the providedCallbacks.
 
- 
- 
- 
Field Detail- 
smprotected static final StringManager sm The string manager for this package.
 - 
passwordprotected final java.lang.String password The password to be authenticated with.
 - 
realmprotected final JAASRealm realm The associatedJAASRealminstance.
 - 
usernameprotected final java.lang.String username The username to be authenticated with.
 - 
nonceprotected final java.lang.String nonce Server generated nonce.
 - 
ncprotected final java.lang.String nc Nonce count.
 - 
cnonceprotected final java.lang.String cnonce Client generated nonce.
 - 
qopprotected final java.lang.String qop Quality of protection applied to the message.
 - 
realmNameprotected final java.lang.String realmName Realm name.
 - 
md5a2protected final java.lang.String md5a2 Second MD5 digest.
 - 
authMethodprotected final java.lang.String authMethod The authentication method to be used. If null, assume BASIC/FORM.
 
- 
 - 
Constructor Detail- 
JAASCallbackHandlerpublic JAASCallbackHandler(JAASRealm realm, java.lang.String username, java.lang.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 instance
- username- Username to be authenticated with
- password- Password to be authenticated with
 
 - 
JAASCallbackHandlerpublic JAASCallbackHandler(JAASRealm realm, java.lang.String username, java.lang.String password, java.lang.String nonce, java.lang.String nc, java.lang.String cnonce, java.lang.String qop, java.lang.String realmName, java.lang.String md5a2, java.lang.String authMethod) Construct a callback handler for DIGEST authentication.- Parameters:
- realm- Our associated JAASRealm instance
- username- Username to be authenticated with
- password- Password to be authenticated with
- nonce- Server generated nonce
- nc- Nonce count
- cnonce- Client generated nonce
- qop- Quality of protection applied to the message
- realmName- Realm name
- md5a2- Second MD5 digest used to calculate the digest MD5(Method + ":" + uri)
- authMethod- The authentication method in use
 
 
- 
 - 
Method Detail- 
handlepublic void handle(javax.security.auth.callback.Callback[] callbacks) throws java.io.IOException, javax.security.auth.callback.UnsupportedCallbackExceptionRetrieve 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 interface- javax.security.auth.callback.CallbackHandler
- Parameters:
- callbacks- The set of- Callbacks to be processed
- Throws:
- java.io.IOException- if an input/output error occurs
- javax.security.auth.callback.UnsupportedCallbackException- if the login method requests an unsupported callback type
 
 
- 
 
-