com.arsdigita.kernel.security
Class MappingLoginModule

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

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

Superclass of LoginModules that map usernames to user IDs. Translates the username provided by the user into a numeric user ID used within ACS. A subclass of this class is needed in any login configuration that uses a PasswordLoginModule.

Author:
Sameer Ajmani

Field Summary
static String versionId
           
 
Constructor Summary
MappingLoginModule()
           
 
Method Summary
 boolean abort()
          Trivial implementation; does nothing.
 boolean commit()
          Adds the user ID to the Subject in a PartyPrincipal.
protected abstract  BigDecimal getUserID(String username)
          Maps a username to a user ID.
 void initialize(javax.security.auth.Subject subject, javax.security.auth.callback.CallbackHandler handler, Map shared, Map options)
           
 boolean login()
          Reads the username from the shared data and calls getUserID.
 boolean logout()
          Trivial implementation; does nothing.
 
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
Constructor Detail

MappingLoginModule

public MappingLoginModule()
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
Reads the username from the shared data and calls getUserID.

Specified by:
login in interface javax.security.auth.spi.LoginModule
Returns:
true.
Throws:
javax.security.auth.login.FailedLoginException - if no username is available.
javax.security.auth.login.LoginException - if an error occurs. Propagates exceptions thrown by getUserID.
See Also:
getUserID(String)

getUserID

protected abstract BigDecimal getUserID(String username)
                                 throws AccountNotFoundException,
                                        javax.security.auth.login.LoginException
Maps a username to a user ID.

Parameters:
username - the username to map
Returns:
the user ID corresponding to the given username.
Throws:
AccountNotFoundException - if no user ID exists for the given username.
javax.security.auth.login.LoginException - if an error occurs.

commit

public boolean commit()
               throws javax.security.auth.login.LoginException
Adds the user ID to the Subject in a PartyPrincipal.

Specified by:
commit in interface javax.security.auth.spi.LoginModule
Returns:
true.
Throws:
javax.security.auth.login.LoginException

abort

public boolean abort()
              throws javax.security.auth.login.LoginException
Trivial implementation; does nothing.

Specified by:
abort in interface javax.security.auth.spi.LoginModule
Returns:
true.
Throws:
javax.security.auth.login.LoginException

logout

public boolean logout()
               throws javax.security.auth.login.LoginException
Trivial implementation; does nothing.

Specified by:
logout in interface javax.security.auth.spi.LoginModule
Returns:
true.
Throws:
javax.security.auth.login.LoginException


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