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.
| Modifier and Type | Field and Description | 
|---|---|
| protected String | authMethodThe authentication method to be used. | 
| protected String | cnonceClient generated nonce. | 
| protected String | md5a2Second MD5 digest. | 
| protected String | ncNonce count. | 
| protected String | nonceServer generated nonce. | 
| protected String | passwordThe password to be authenticated with. | 
| protected String | qopQuality of protection applied to the message. | 
| protected JAASRealm | realmThe associated  JAASRealminstance. | 
| protected String | realmNameRealm name. | 
| protected static StringManager | smThe string manager for this package. | 
| protected String | usernameThe username to be authenticated with. | 
| Constructor and 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. | 
protected static final StringManager sm
protected String password
protected JAASRealm realm
JAASRealm instance.protected String username
protected String nonce
protected String nc
protected String cnonce
protected String qop
protected String realmName
protected String md5a2
protected String authMethod
public JAASCallbackHandler(JAASRealm realm, String username, String password)
JAASRealm instance specifies digested passwords,
 the password parameter will be pre-digested here.realm - Our associated JAASRealm instanceusername - Username to be authenticated withpassword - Password to be authenticated withpublic JAASCallbackHandler(JAASRealm realm, String username, String password, String nonce, String nc, String cnonce, String qop, String realmName, String md5a2, String authMethod)
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 usepublic void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException
Callbacks.
 This implementation only recognizes NameCallback,
 PasswordCallback and TextInputCallback.
 TextInputCallback is used to pass the various additional
 parameters required for DIGEST authentication.handle in interface CallbackHandlercallbacks - The set of Callbacks to be processedIOException - if an input/output error occursUnsupportedCallbackException - if the login method requests
  an unsupported callback typeCopyright © 2000-2020 Apache Software Foundation. All Rights Reserved.