info.magnolia.jaas.sp
Class AbstractLoginModule

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

public abstract class AbstractLoginModule
extends Object
implements LoginModule

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

Author:
Sameer Charles $Id$

Field Summary
 CallbackHandler callbackHandler
           
protected  org.slf4j.Logger log
           
 String name
           
static String OPTION_REALM
           
static String OPTION_SKIP_ON_PREVIOUS_SUCCESS
           
static String OPTION_USE_REALM_CALLBACK
           
 Map<String,Object> options
           
 char[] pswd
           
protected  Realm realm
          The realm we login into.
 Map<String,Object> sharedState
           
static 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
           
 Subject subject
           
 boolean success
           
static String TRY_FIRST_PASS
           
static String TRY_MAPPED_PASS
           
static String USE_FIRST_PASS
           
static 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(String groupName)
           
 void addRoleName(String roleName)
           
 boolean commit()
          Updates subject with ACL and other properties.
 Set<String> getGroupNames()
           
 Set<String> 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(Subject subject, CallbackHandler callbackHandler, Map sharedState, Map options)
           
 boolean login()
           
 boolean logout()
           
 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(Set<String> names)
           
 void setRoleNames(Set<String> 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 String OPTION_SKIP_ON_PREVIOUS_SUCCESS
See Also:
Constant Field Values

OPTION_REALM

public static final String OPTION_REALM
See Also:
Constant Field Values

OPTION_USE_REALM_CALLBACK

public static final String OPTION_USE_REALM_CALLBACK
See Also:
Constant Field Values

STATUS

public static final String STATUS
See Also:
Constant Field Values

STATUS_SUCCEEDED

public static final int STATUS_SUCCEEDED
See Also:
Constant Field Values

STATUS_SUCCEDED

@Deprecated
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 String TRY_FIRST_PASS
See Also:
Constant Field Values

USE_FIRST_PASS

public static final String USE_FIRST_PASS
See Also:
Constant Field Values

TRY_MAPPED_PASS

public static final String TRY_MAPPED_PASS
See Also:
Constant Field Values

USE_MAPPED_PASS

public static final String USE_MAPPED_PASS
See Also:
Constant Field Values

subject

public Subject subject

callbackHandler

public CallbackHandler callbackHandler

sharedState

public Map<String,Object> sharedState

options

public Map<String,Object> options

name

public String name

pswd

public char[] pswd

realm

protected Realm 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(Subject subject,
                       CallbackHandler callbackHandler,
                       Map sharedState,
                       Map options)
Specified by:
initialize in interface LoginModule

login

public boolean login()
              throws LoginException
Specified by:
login in interface LoginModule
Throws:
LoginException

commit

public boolean commit()
               throws LoginException
Updates subject with ACL and other properties.

Specified by:
commit in interface LoginModule
Throws:
LoginException

abort

public boolean abort()
              throws LoginException
Specified by:
abort in interface LoginModule
Throws:
LoginException

logout

public boolean logout()
               throws LoginException
Specified by:
logout in interface LoginModule
Throws:
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(Set<String> names)

addGroupName

public void addGroupName(String groupName)

getGroupNames

public Set<String> getGroupNames()

setRoleNames

public void setRoleNames(Set<String> names)

addRoleName

public void addRoleName(String roleName)

getRoleNames

public Set<String> getRoleNames()

release

public boolean release()
Releases all associated memory.


validateUser

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

Throws:
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-2013 Magnolia International Ltd.. All Rights Reserved.