|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Object | +--com.cafesoft.cams.auth.login.module.AbstractLoginModule
Abstract implementation of the LoginModule interface. This class provides implementation for standard methods used to plug LoginModules into the Cams policy server infrastructure. For instance, the ability to set the Logger and ServiceFinder objects. In addition, this method has stubbed out the methods that must be implemented by subclasses.
LoggerClient,
ServiceClient,
LoginModule| Field Summary | |
protected CallbackHandler |
callbackHandler
CallbackHandler that provides the means for accessing user supplied data. |
protected boolean |
debug
Enables/disables debugging. |
protected Logger |
logger
LoginModule's logger. |
protected Map |
options
The LoginModule's configuration options. |
protected ServiceFinder |
serviceFinder
ServiceFinder that makes Cams services available to the LoginModule. |
protected Map |
sharedState
Map that contains state shared with other configured LoginModules. |
protected Subject |
subject
The subject being authenticated. |
| Constructor Summary | |
AbstractLoginModule()
Creates a new AbstractLoginModule. |
|
| Method Summary | |
boolean |
abort()
Method to abort the authentication process (phase 2). |
protected abstract boolean |
abortAuthentication()
Abort authentication attempt. |
protected abstract boolean |
associateRoles()
Associate the roles with the user. |
protected abstract boolean |
authenticate()
Authenticate the user. |
boolean |
commit()
Method to commit the authentication process (phase 2). |
void |
destroy()
Destroy the object and it's resources. |
void |
initialize(Subject subject,
CallbackHandler callbackHandler,
Map sharedState,
Map options)
Initialize this LoginModule. |
boolean |
login()
Method to authenticate a Subject (phase 1).
|
boolean |
logout()
Method which logs out a Subject.
|
protected abstract boolean |
logoutUser()
Log an authenticated user out. |
void |
setLogger(Logger logger)
Sets the logger. |
void |
setServiceFinder(ServiceFinder finder)
Set the ServiceFinder. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected CallbackHandler callbackHandler
protected boolean debug
protected Logger logger
protected Map options
protected ServiceFinder serviceFinder
protected Map sharedState
protected Subject subject
| Constructor Detail |
public AbstractLoginModule()
| Method Detail |
public final void setLogger(Logger logger)
setLogger in interface LoggerClientlogger - logs messages.public final void setServiceFinder(ServiceFinder finder)
setServiceFinder in interface ServiceClientfinder - the class used by find Services by the ServiceClient.public void destroy()
This method when called should free all resources used by this object. In addition, it should render the object unusable. Therefore, this method should only be called once per object.
destroy in interface Destroyable
public void initialize(Subject subject,
CallbackHandler callbackHandler,
Map sharedState,
Map options)
This method is called by the LoginContext
after this LoginModule has been instantiated.
The purpose of this method is to initialize this
LoginModule with the relevant information.
If this LoginModule does not understand
any of the data stored in sharedState or
options parameters, they can be ignored.
initialize in interface LoginModulesubject - the Subject to be authenticated.callbackHandler - a CallbackHandler for communicating
with the end user (prompting for usernames and passwords, for example).sharedState - state shared with other configured LoginModules.options - options specified in the login Configuration
for this particular LoginModule.
public final boolean login()
throws LoginException
Subject (phase 1).
The implementation of this method authenticates
a Subject. For example, it may prompt for
Subject information such as a username and password
and then attempt to verify the password. This method saves the
result of the authentication attempt as private state within
the LoginModule.
login in interface LoginModuleLoginModule should be ignored.
LoginException - if the authentication fails.
public final boolean commit()
throws LoginException
This method is called if the LoginContext's overall authentication succeeded (the relevant REQUIRED, REQUISITE, SUFFICIENT and OPTIONAL LoginModules succeeded).
If this LoginModule's own authentication attempt
succeeded (checked by retrieving the private state saved by the
login method), then this method associates relevant
Principals and Credentials with the Subject located in the
LoginModule. If this LoginModule's own
authentication attempted failed, then this method removes/destroys
any state that was originally saved.
commit in interface LoginModuleLoginModule should be ignored.
LoginException - if the commit fails.
public final boolean abort()
throws LoginException
This method is called if the LoginContext's overall authentication failed. (the relevant REQUIRED, REQUISITE, SUFFICIENT and OPTIONAL LoginModules did not succeed).
If this LoginModule's own authentication attempt
succeeded (checked by retrieving the private state saved by the
login method), then this method cleans up any state
that was originally saved.
abort in interface LoginModuleLoginModule should be ignored.
LoginException - if the abort fails.
public final boolean logout()
throws LoginException
Subject.
An implementation of this method might remove/destroy a Subject's Principals and Credentials.
logout in interface LoginModuleLoginModule should be ignored.
LoginException - if the logout fails
protected abstract boolean authenticate()
throws LoginException
LoginException - if an error occurs authenticating.
protected abstract boolean associateRoles()
throws LoginException
LoginException - if an error occurs associating user roles.
protected abstract boolean abortAuthentication()
throws LoginException
LoginException - if an error occurs aborting authentication.
protected abstract boolean logoutUser()
throws LoginException
LoginException - if an error occurs logging user out.
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||