info.magnolia.jaas.sp
Class AbstractLoginModule

java.lang.Object
  extended by info.magnolia.jaas.sp.AbstractLoginModule
All Implemented Interfaces:
javax.security.auth.spi.LoginModule
Direct Known Subclasses:
JCRAuthenticationModule, JCRAuthorizationModule

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

Abstract implementation of the LoginModule providing common methods and constants implementation.

Author:
Sameer Charles $Id: AbstractLoginModule.java 41137 2011-01-06 18:19:25Z gjoseph $

Field Summary
 javax.security.auth.callback.CallbackHandler callbackHandler
           
protected  org.slf4j.Logger log
           
 java.lang.String name
           
static java.lang.String OPTION_REALM
           
static java.lang.String OPTION_SKIP_ON_PREVIOUS_SUCCESS
           
static java.lang.String OPTION_USE_REALM_CALLBACK
           
 java.util.Map options
           
 char[] pswd
           
protected  java.lang.String realm
          The realm we login into.
 java.util.Map sharedState
           
static java.lang.String STATUS
           
static int STATUS_FAILED
           
static int STATUS_SKIPPED
           
static int STATUS_SUCCEDED
          Deprecated. use STATUS_SUCCEEDED
static int STATUS_SUCCEEDED
           
static int STATUS_UNAVAILABLE
           
 javax.security.auth.Subject subject
           
 boolean success
           
static java.lang.String TRY_FIRST_PASS
           
static java.lang.String TRY_MAPPED_PASS
           
static java.lang.String USE_FIRST_PASS
           
static java.lang.String USE_MAPPED_PASS
           
protected  boolean useRealmCallback
          Allow the client to define the realm he logs into.
 
Constructor Summary
AbstractLoginModule()
           
 
Method Summary
 boolean abort()
           
 void addGroupName(java.lang.String groupName)
           
 void addRoleName(java.lang.String roleName)
           
 boolean commit()
          Updates subject with ACL and other properties.
 java.util.Set getGroupNames()
           
 java.util.Set getRoleNames()
           
 int getSharedStatus()
           
protected  boolean getSkip()
          Tests if the option skip_on_previous_success is set to true and preceding LoginModule was successful.
 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()
           
abstract  boolean release()
          Releases all associated memory.
abstract  void setACL()
          Sets access control list from the user, roles and groups.
abstract  void setEntity()
          Sets user details.
 void setGroupNames(java.util.Set names)
           
 void setRoleNames(java.util.Set names)
           
 void setSharedStatus(int status)
          Sets shared status value to be used by subsequent LoginModule(s).
abstract  void validateUser()
          Checks if the credentials exist in the repository.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

OPTION_SKIP_ON_PREVIOUS_SUCCESS

public static final java.lang.String OPTION_SKIP_ON_PREVIOUS_SUCCESS
See Also:
Constant Field Values

OPTION_REALM

public static final java.lang.String OPTION_REALM
See Also:
Constant Field Values

OPTION_USE_REALM_CALLBACK

public static final java.lang.String OPTION_USE_REALM_CALLBACK
See Also:
Constant Field Values

STATUS

public static final java.lang.String STATUS
See Also:
Constant Field Values

STATUS_SUCCEEDED

public static final int STATUS_SUCCEEDED
See Also:
Constant Field Values

STATUS_SUCCEDED

public static final int STATUS_SUCCEDED
Deprecated. use STATUS_SUCCEEDED
See Also:
Constant Field Values

STATUS_FAILED

public static final int STATUS_FAILED
See Also:
Constant Field Values

STATUS_SKIPPED

public static final int STATUS_SKIPPED
See Also:
Constant Field Values

STATUS_UNAVAILABLE

public static final int STATUS_UNAVAILABLE
See Also:
Constant Field Values

TRY_FIRST_PASS

public static final java.lang.String TRY_FIRST_PASS
See Also:
Constant Field Values

USE_FIRST_PASS

public static final java.lang.String USE_FIRST_PASS
See Also:
Constant Field Values

TRY_MAPPED_PASS

public static final java.lang.String TRY_MAPPED_PASS
See Also:
Constant Field Values

USE_MAPPED_PASS

public static final java.lang.String USE_MAPPED_PASS
See Also:
Constant Field Values

subject

public javax.security.auth.Subject subject

callbackHandler

public javax.security.auth.callback.CallbackHandler callbackHandler

sharedState

public java.util.Map sharedState

options

public java.util.Map options

name

public java.lang.String name

pswd

public char[] pswd

realm

protected java.lang.String realm
The realm we login into. Initialized by the option realm.


useRealmCallback

protected boolean useRealmCallback
Allow the client to define the realm he logs into. Default value is false


success

public boolean success

log

protected org.slf4j.Logger log
Constructor Detail

AbstractLoginModule

public AbstractLoginModule()
Method Detail

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

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

commit

public boolean commit()
               throws javax.security.auth.login.LoginException
Updates subject with ACL and other properties.

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

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

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

getSharedStatus

public int getSharedStatus()
Returns:
shared status value as set by this LoginModule

setSharedStatus

public void setSharedStatus(int status)
Sets shared status value to be used by subsequent LoginModule(s).


getSkip

protected boolean getSkip()
Tests if the option skip_on_previous_success is set to true and preceding LoginModule was successful.


setGroupNames

public void setGroupNames(java.util.Set names)

addGroupName

public void addGroupName(java.lang.String groupName)

getGroupNames

public java.util.Set getGroupNames()

setRoleNames

public void setRoleNames(java.util.Set names)

addRoleName

public void addRoleName(java.lang.String roleName)

getRoleNames

public java.util.Set getRoleNames()

release

public abstract boolean release()
Releases all associated memory.


validateUser

public abstract void validateUser()
                           throws javax.security.auth.login.LoginException
Checks if the credentials exist in the repository.

Throws:
javax.security.auth.login.LoginException - or specific subclasses to report failures.

setEntity

public abstract void setEntity()
Sets user details.


setACL

public abstract void setACL()
Sets access control list from the user, roles and groups.



Copyright © 2003-2011 Magnolia International Ltd.. All Rights Reserved.