com.arsdigita.kernel.security
Class PasswordLoginModule

java.lang.Object
  extended bycom.arsdigita.kernel.security.PasswordLoginModule
All Implemented Interfaces:
javax.security.auth.spi.LoginModule
Direct Known Subclasses:
LocalLoginModule

public abstract class PasswordLoginModule
extends Object
implements javax.security.auth.spi.LoginModule

Superclass of LoginModules that authenticate users using a username and password. Fetches the username/password from shared data if possible, otherwise queries the user directly using callbacks. Saves the username/password in shared data for use by other LoginModules.

Author:
Sameer Ajmani

Field Summary
static String NAME_KEY
          Key for username in shared data map.
static String PASSWORD_KEY
          Key for password in shared data map.
static String versionId
           
 
Constructor Summary
PasswordLoginModule()
           
 
Method Summary
abstract  boolean abort()
           
protected abstract  void checkPassword(String username, char[] password)
          Checks whether the given username/password combination is valid.
abstract  boolean commit()
           
 void initialize(javax.security.auth.Subject subject, javax.security.auth.callback.CallbackHandler handler, Map shared, Map options)
           
 boolean login()
          Retreives the username and password and calls the checkPassword method.
abstract  boolean logout()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

versionId

public static final String versionId
See Also:
Constant Field Values

NAME_KEY

public static final String NAME_KEY
Key for username in shared data map.

See Also:
Constant Field Values

PASSWORD_KEY

public static final String PASSWORD_KEY
Key for password in shared data map.

See Also:
Constant Field Values
Constructor Detail

PasswordLoginModule

public PasswordLoginModule()
Method Detail

initialize

public void initialize(javax.security.auth.Subject subject,
                       javax.security.auth.callback.CallbackHandler handler,
                       Map shared,
                       Map options)
Specified by:
initialize in interface javax.security.auth.spi.LoginModule

login

public boolean login()
              throws javax.security.auth.login.LoginException
Retreives the username and password and calls the checkPassword method.

Specified by:
login in interface javax.security.auth.spi.LoginModule
Returns:
true.
Throws:
javax.security.auth.login.LoginException - if an error occurs. Propagates exceptions thrown by the checkPassword method.
See Also:
checkPassword(String, char[])

checkPassword

protected abstract void checkPassword(String username,
                                      char[] password)
                               throws javax.security.auth.login.LoginException
Checks whether the given username/password combination is valid.

Parameters:
username - the username to check
password - the password to check
Throws:
AccountNotFoundException - if the account does not exist.
AccountExpiredException - if the account has expired.
AccountLockedException - if the account is locked.
FailedLoginException - if the password is invalid.
javax.security.auth.login.LoginException - if an error occurs.

commit

public abstract boolean commit()
                        throws javax.security.auth.login.LoginException
Specified by:
commit in interface javax.security.auth.spi.LoginModule
Throws:
javax.security.auth.login.LoginException

abort

public abstract boolean abort()
                       throws javax.security.auth.login.LoginException
Specified by:
abort in interface javax.security.auth.spi.LoginModule
Throws:
javax.security.auth.login.LoginException

logout

public abstract boolean logout()
                        throws javax.security.auth.login.LoginException
Specified by:
logout in interface javax.security.auth.spi.LoginModule
Throws:
javax.security.auth.login.LoginException


Copyright (c) 2004 Red Hat, Inc. Corporation. All Rights Reserved. Generated at July 21 2004:2337 UTC