Top Description Fields Constructors Methods
org.apache.catalina.realm

public Class JAASCallbackHandler

extends Object
implements CallbackHandler
Class Inheritance
All Implemented Interfaces
javax.security.auth.callback.CallbackHandler
Imports
java.io.IOException, javax.security.auth.callback.Callback, .CallbackHandler, .NameCallback, .PasswordCallback, .TextInputCallback, .UnsupportedCallbackException, org.apache.tomcat.util.res.StringManager

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.

Authors
Craig R. McClanahan, Andrew R. Jaquith

Field Summary

Modifier and TypeField and Description
protected final String
authMethod

The authentication method to be used.

protected final String
cnonce

Client generated nonce.

protected final String
digestA2

Second digest.

protected final String
nc

Nonce count.

protected final String
nonce

Server generated nonce.

protected final String
password

The password to be authenticated with.

protected final String
qop

Quality of protection applied to the message.

protected final JAASRealm
realm

The associated JAASRealm instance.

protected final String
realmName

Realm name.

protected static final StringManager
sm

The string manager for this package.

protected final String
username

The username to be authenticated with.

Constructor Summary

AccessConstructor and Description
public
JAASCallbackHandler(JAASRealm
Our associated JAASRealm instance
realm
,
String
Username to be authenticated with
username
,
String
Password to be authenticated with
password
)

Construct a callback handler configured with the specified values.

public
JAASCallbackHandler(JAASRealm
Our associated JAASRealm instance
realm
,
String
Username to be authenticated with
username
,
String
Password to be authenticated with
password
,
String
Server generated nonce
nonce
,
String
Nonce count
nc
,
String
Client generated nonce
cnonce
,
String
Quality of protection applied to the message
qop
,
String
Realm name
realmName
,
String
Second digest calculated as digest(Method + ":" + uri)
digestA2
,
String
The digest algorithm to use
algorithm
,
String
The authentication method in use
authMethod
)

Construct a callback handler for DIGEST authentication.

Method Summary

Modifier and TypeMethod and Description
public void
handle(Callback[]
The set of Callbacks to be processed
callbacks
)

Implements javax.security.auth.callback.CallbackHandler.handle.

Retrieve the information requested in the provided Callbacks.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

authMethodback to summary
protected final String authMethod

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

cnonceback to summary
protected final String cnonce

Client generated nonce.

digestA2back to summary
protected final String digestA2

Second digest.

ncback to summary
protected final String nc

Nonce count.

nonceback to summary
protected final String nonce

Server generated nonce.

passwordback to summary
protected final String password

The password to be authenticated with.

qopback to summary
protected final String qop

Quality of protection applied to the message.

realmback to summary
protected final JAASRealm realm

The associated JAASRealm instance.

realmNameback to summary
protected final String realmName

Realm name.

smback to summary
protected static final StringManager sm

The string manager for this package.

usernameback to summary
protected final String username

The username to be authenticated with.

Constructor Detail

JAASCallbackHandlerback to summary
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:JAASRealm

Our associated JAASRealm instance

username:String

Username to be authenticated with

password:String

Password to be authenticated with

JAASCallbackHandlerback to summary
public JAASCallbackHandler(JAASRealm realm, String username, String password, String nonce, String nc, String cnonce, String qop, String realmName, String digestA2, String algorithm, String authMethod)

Construct a callback handler for DIGEST authentication.

Parameters
realm:JAASRealm

Our associated JAASRealm instance

username:String

Username to be authenticated with

password:String

Password to be authenticated with

nonce:String

Server generated nonce

nc:String

Nonce count

cnonce:String

Client generated nonce

qop:String

Quality of protection applied to the message

realmName:String

Realm name

digestA2:String

Second digest calculated as digest(Method + ":" + uri)

algorithm:String

The digest algorithm to use

authMethod:String

The authentication method in use

Method Detail

handleback to summary
public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException

Implements javax.security.auth.callback.CallbackHandler.handle.

Retrieve the information requested in the provided Callbacks. This implementation only recognizes NameCallback, PasswordCallback and TextInputCallback. TextInputCallback is used to pass the various additional parameters required for DIGEST authentication.

Parameters
callbacks:Callback[]

The set of Callbacks to be processed

Annotations
@Override
Exceptions
IOException:
if an input/output error occurs
UnsupportedCallbackException:
if the login method requests an unsupported callback type