org.apache.jetspeed.security.impl
Class DefaultLoginModule

java.lang.Object
  extended by org.apache.jetspeed.security.impl.DefaultLoginModule
All Implemented Interfaces:
javax.security.auth.spi.LoginModule
Direct Known Subclasses:
JBossLoginModule

public class DefaultLoginModule
extends java.lang.Object
implements javax.security.auth.spi.LoginModule

LoginModule implementation that authenticates a user against a relational database. OJB based implementation.

When a user is successfully authenticated, the user principal are added to the current subject.

The LoginModule also recognizes the debug option.

Configuration files should provide:


 Jetspeed {
   org.apache.jetspeed.security.impl.DefaultLoginModule required debug=true;
 };
 

Author:
David Le Strat

Field Summary
protected  javax.security.auth.callback.CallbackHandler callbackHandler
          A CallbackHandler for communicating with the end user (prompting for usernames and passwords, for example).
protected  boolean commitSuccess
          The commit status.
protected  boolean debug
          LoginModule debug mode is turned off by default.
protected  java.util.Map options
          Options specified in the login Configuration for this particular LoginModule.
protected  java.lang.String portalUserRole
          The portal user role.
protected  java.util.Map sharedState
          State shared with other configured LoginModules.
protected  javax.security.auth.Subject subject
          The Subject to be authenticated.
protected  boolean success
          The authentication status.
protected  UserManager ums
          InternalUserPrincipal manager service.
protected  java.lang.String username
          The user name.
 
Constructor Summary
  DefaultLoginModule()
          The default login module constructor.
protected DefaultLoginModule(UserManager userManager)
           
protected DefaultLoginModule(UserManager userManager, java.lang.String portalUserRole)
          Create a new login module that uses the given user manager.
 
Method Summary
 boolean abort()
           
 boolean commit()
           
protected  void commitPrincipals(javax.security.auth.Subject subject, User user)
          Default setup of the logged on Subject Principals for Tomcat
protected  java.security.Principal getUserPrincipal(User user)
           
protected  java.util.List getUserRoles(User user)
           
 void initialize(javax.security.auth.Subject subject, javax.security.auth.callback.CallbackHandler callbackHandler, java.util.Map sharedState, java.util.Map options)
           
 boolean login()
           
 boolean logout()
           
protected  void refreshProxy()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

debug

protected boolean debug

LoginModule debug mode is turned off by default.


success

protected boolean success

The authentication status.


commitSuccess

protected boolean commitSuccess

The commit status.


subject

protected javax.security.auth.Subject subject

The Subject to be authenticated.


callbackHandler

protected javax.security.auth.callback.CallbackHandler callbackHandler

A CallbackHandler for communicating with the end user (prompting for usernames and passwords, for example).


sharedState

protected java.util.Map sharedState

State shared with other configured LoginModules.


options

protected java.util.Map options

Options specified in the login Configuration for this particular LoginModule.


ums

protected UserManager ums

InternalUserPrincipal manager service.


portalUserRole

protected java.lang.String portalUserRole
The portal user role.


username

protected java.lang.String username

The user name.

Constructor Detail

DefaultLoginModule

public DefaultLoginModule()

The default login module constructor.


DefaultLoginModule

protected DefaultLoginModule(UserManager userManager,
                             java.lang.String portalUserRole)
Create a new login module that uses the given user manager.

Parameters:
userManager - the user manager to use
portalUserRole - the portal user role to use

DefaultLoginModule

protected DefaultLoginModule(UserManager userManager)
Method Detail

abort

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

refreshProxy

protected void refreshProxy()

commit

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

login

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

logout

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

initialize

public void initialize(javax.security.auth.Subject subject,
                       javax.security.auth.callback.CallbackHandler callbackHandler,
                       java.util.Map sharedState,
                       java.util.Map options)
Specified by:
initialize in interface javax.security.auth.spi.LoginModule
See Also:
LoginModule.initialize(javax.security.auth.Subject, javax.security.auth.callback.CallbackHandler, java.util.Map, java.util.Map)

getUserPrincipal

protected java.security.Principal getUserPrincipal(User user)

getUserRoles

protected java.util.List getUserRoles(User user)

commitPrincipals

protected void commitPrincipals(javax.security.auth.Subject subject,
                                User user)
Default setup of the logged on Subject Principals for Tomcat

Parameters:
subject -
user -


Copyright © 1999-2009 Apache Software Foundation. All Rights Reserved.