FileDocCategorySizeDatePackage
ServerLoginCallbackHandler.javaAPI DocGlassfish v2 API3711Fri May 04 22:35:26 BST 2007com.sun.enterprise.security.auth.login

ServerLoginCallbackHandler

public class ServerLoginCallbackHandler extends Object implements CallbackHandler
This is the default callback handler provided by the application client container. The container tries to use the application specified callback handler (if provided). If there is no callback handler or if the handler cannot be instantiated then this default handler is used.

Fields Summary
String
username
String
password
Constructors Summary
public ServerLoginCallbackHandler(String username, String password)

 

         
	this.username = username;
	this.password = password;
    
public ServerLoginCallbackHandler()

	username = null;
	password = null;
    
Methods Summary
public voidhandle(javax.security.auth.callback.Callback[] callbacks)
This is the callback method called when authentication data is required. It either pops up a dialog box to request authentication data or use text input.

param
the callback object instances supported by the login module.

	for (int i = 0; i < callbacks.length; i++) {
            if (callbacks[i] instanceof NameCallback){
		NameCallback nme = (NameCallback)callbacks[i];
		nme.setName(username);
	    } else if (callbacks[i] instanceof PasswordCallback){
		PasswordCallback pswd = (PasswordCallback)callbacks[i];
		pswd.setPassword(password.toCharArray());
	    }
	}
    
public voidsetPassword(java.lang.String pass)

	password = pass;
    
public voidsetUsername(java.lang.String user)

	username = user;