FileDocCategorySizeDatePackage
LoginContext.javaAPI DocGlassfish v2 API4348Fri May 04 22:35:22 BST 2007com.sun.enterprise.security

LoginContext

public final class LoginContext extends Object
This class is kept for CTS. Ideally we should move away from it. The login can be done via the following call:
// Initialize the ORB.
try {
LoginContext lc = new LoginContext();
lc.login("john", "john123");
} catch (LoginException le) {
le.printStackTrace();
}


Ideally the login should be done with the system property -Dj2eelogin.name and -Dj2eelogin.password
author
Harpreet Singh (hsingh@eng.sun.com)

Fields Summary
private static Logger
_logger
private boolean
guiAuth
public CallbackHandler
handler
Constructors Summary
public LoginContext()
Creates the LoginContext with the defauly callback handler

    
                 
       
	handler = new com.sun.enterprise.security.auth.login.LoginCallbackHandler(guiAuth);
    
Methods Summary
public voidlogin(java.lang.String user, java.lang.String pass)
Login method to login username and password

	final String username = user;
	final String password = pass;
	AppservAccessController.doPrivileged(new PrivilegedAction() {
	    public java.lang.Object run() {
		
		System.setProperty(ClientPasswordLoginModule.LOGIN_NAME,
				   username);
		System.setProperty(ClientPasswordLoginModule.LOGIN_PASSWORD, 
				   password);

		    return null;
		}
	    });
	// Since this is  a private api and the user is not supposed to use
	// this. We use the default the LoginCallbackHandler.
	LoginContextDriver.doClientLogin(AppContainer.USERNAME_PASSWORD,
					 handler);
    
public voidlogin(java.lang.String username, byte[] authData)
This method has been provided to satisfy the CTS Porting Package requirement for logging in a certificate

    
	    // do nothing