org.apache.catalina.realm

Class JAASCallbackHandler

public class JAASCallbackHandler extends Object implements CallbackHandler

Implementation of the JAAS CallbackHandler interface, 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 CallbackHandler will pre-digest the supplied password, if required by the <Realm> element in server.xml.

At present, JAASCallbackHandler knows how to handle callbacks of type javax.security.auth.callback.NameCallback and javax.security.auth.callback.PasswordCallback.

Version: $Revision: 692717 $ $Date: 2008-09-06 21:52:56 +0200 (Sat, 06 Sep 2008) $

Author: Craig R. McClanahan Andrew R. Jaquith

Field Summary
protected StringauthMethod
The authentication method to be used.
protected Stringcnonce
Client generated nonce.
protected Stringmd5a2
Second MD5 digest.
protected Stringnc
Nonce count.
protected Stringnonce
Server generated nonce.
protected Stringpassword
The password to be authenticated with.
protected Stringqop
Quality of protection aplied to the message.
protected JAASRealmrealm
The associated JAASRealm instance.
protected StringrealmName
Realm name.
protected static StringManagersm
The string manager for this package.
protected Stringusername
The username to be authenticated with.
Constructor Summary
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
voidhandle(Callback[] callbacks)
Retrieve the information requested in the provided Callbacks.

Field Detail

authMethod

protected String authMethod
The authentication method to be used. If null, assume BASIC/FORM.

cnonce

protected String cnonce
Client generated nonce.

md5a2

protected String md5a2
Second MD5 digest.

nc

protected String nc
Nonce count.

nonce

protected String nonce
Server generated nonce.

password

protected String password
The password to be authenticated with.

qop

protected String qop
Quality of protection aplied to the message.

realm

protected JAASRealm realm
The associated JAASRealm instance.

realmName

protected String realmName
Realm name.

sm

protected static final StringManager sm
The string manager for this package.

username

protected String username
The username to be authenticated with.

Constructor Detail

JAASCallbackHandler

public JAASCallbackHandler(JAASRealm realm, String username, String password)
Construct a callback handler configured with the specified values. Note that if the JAASRealm instance specifies digested passwords, the password parameter will be pre-digested here.

Parameters: realm Our associated JAASRealm instance username Username to be authenticated with password 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 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 aplied 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

handle

public void handle(Callback[] callbacks)
Retrieve the information requested in the provided Callbacks. This implementation only recognizes NameCallback, PasswordCallback and TextInputCallback. TextInputCallback is ued to pass the various additional parameters required for DIGEST authentication.

Parameters: callbacks The set of Callbacks to be processed

Throws: IOException if an input/output error occurs UnsupportedCallbackException if the login method requests an unsupported callback type

Copyright © 2000-2011 Apache Software Foundation. All Rights Reserved.