|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.sun.appserv.security.AppservPasswordLoginModule
@Service @Scoped(value=PerLookup.class) public class AppservPasswordLoginModule
Abstract base class for password-based login modules.
Most login modules receive a username and password from the client (possibly through HTTP BASIC auth, or FORM, or other mechanism) and then make (or delegate) an authentication decision based on this data. This class provides common methods for such password-based login modules.
Subclasses need to implement the authenticateUser() method and later call commitUserAuthentication().
| Field Summary | |
|---|---|
protected boolean |
_commitSucceeded
|
protected com.sun.enterprise.security.auth.realm.Realm |
_currentRealm
|
protected String[] |
_groupsList
|
protected Logger |
_logger
|
protected Map |
_options
|
protected String |
_password
|
protected Map |
_sharedState
|
protected Subject |
_subject
|
protected boolean |
_succeeded
|
protected String |
_username
|
protected PrincipalImpl |
_userPrincipal
|
protected static StringManager |
sm
|
| Constructor Summary | |
|---|---|
AppservPasswordLoginModule()
|
|
| Method Summary | |
|---|---|
boolean |
abort()
Abort the authentication process. |
protected void |
authenticateUser()
Perform authentication decision. |
boolean |
commit()
Commit the authentication. |
void |
commitUserAuthentication(String[] groups)
This is a convenience method which can be used by subclasses |
void |
extractCredentials()
Method to extract container-provided username and password |
com.sun.enterprise.security.auth.realm.Realm |
getCurrentRealm()
|
String[] |
getGroupsList()
|
String |
getPassword()
|
Subject |
getSubject()
|
String |
getUsername()
|
PrincipalImpl |
getUserPrincipal()
|
void |
initialize(Subject subject,
CallbackHandler callbackHandler,
Map sharedState,
Map options)
Initialize this login module. |
boolean |
isCommitSucceeded()
|
boolean |
isSucceeded()
|
boolean |
login()
Perform login. |
boolean |
logout()
Log out the subject. |
void |
setLoginModuleForAuthentication(LoginModule userDefinedLoginModule)
Set the Login Module that needs to be used for the AuthenticateUser call |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected Subject _subject
protected Map _sharedState
protected Map _options
protected String _username
protected String _password
protected com.sun.enterprise.security.auth.realm.Realm _currentRealm
protected boolean _succeeded
protected boolean _commitSucceeded
protected PrincipalImpl _userPrincipal
protected String[] _groupsList
protected Logger _logger
protected static final StringManager sm
| Constructor Detail |
|---|
public AppservPasswordLoginModule()
| Method Detail |
|---|
public final void initialize(Subject subject,
CallbackHandler callbackHandler,
Map sharedState,
Map options)
initialize in interface LoginModulesubject - - the Subject to be authenticated.callbackHandler - - a CallbackHandler for obtaining the subject
username and password.sharedState - - state shared with other configured LoginModules.options - - options specified in the login Configuration for
this particular LoginModule.
public final boolean login()
throws LoginException
The callback handler is used to obtain authentication info for the subject and a login is attempted. This PasswordLoginModule expects to find a PasswordCredential in the private credentials of the Subject. If not present the login fails. The callback handler is ignored as it is not really relevant on the server side. Finally, the authenticateUser() method is invoked.
login in interface LoginModuleLoginException - Thrown if login failed, or on other problems.
public boolean commit()
throws LoginException
Commit is called after all necessary login modules have succeeded. It adds (if not present) a PrincipalImpl principal and a LocalCredentials public credential to the Subject.
commit in interface LoginModuleLoginException - If commit fails.
public final boolean abort()
throws LoginException
abort in interface LoginModuleLoginException
public final boolean logout()
throws LoginException
logout in interface LoginModuleLoginExceptionpublic final void commitUserAuthentication(String[] groups)
This is a convenience method which can be used by subclasses
Note that this method is called after the authentication has succeeded. If authentication failed do not call this method. Global instance field succeeded is set to true by this method.
commitUserAuthentication in interface com.sun.enterprise.security.common.AppservPasswordLoginModuleInterfacegroups - String array of group memberships for user (could be
empty).public Subject getSubject()
getSubject in interface com.sun.enterprise.security.common.AppservPasswordLoginModuleInterface
public final void extractCredentials()
throws LoginException
extractCredentials in interface com.sun.enterprise.security.common.AppservPasswordLoginModuleInterfaceLoginException
protected void authenticateUser()
throws LoginException
LoginException - on authentication failure.public void setLoginModuleForAuthentication(LoginModule userDefinedLoginModule)
com.sun.enterprise.security.common.AppservPasswordLoginModuleInterface
setLoginModuleForAuthentication in interface com.sun.enterprise.security.common.AppservPasswordLoginModuleInterfaceuserDefinedLoginModule - the userdefined login modulepublic String getUsername()
getUsername in interface com.sun.enterprise.security.common.AppservPasswordLoginModuleInterfacepublic String getPassword()
getPassword in interface com.sun.enterprise.security.common.AppservPasswordLoginModuleInterfacepublic com.sun.enterprise.security.auth.realm.Realm getCurrentRealm()
getCurrentRealm in interface com.sun.enterprise.security.common.AppservPasswordLoginModuleInterfacepublic boolean isSucceeded()
isSucceeded in interface com.sun.enterprise.security.common.AppservPasswordLoginModuleInterfacepublic boolean isCommitSucceeded()
isCommitSucceeded in interface com.sun.enterprise.security.common.AppservPasswordLoginModuleInterfacepublic PrincipalImpl getUserPrincipal()
getUserPrincipal in interface com.sun.enterprise.security.common.AppservPasswordLoginModuleInterfacepublic String[] getGroupsList()
getGroupsList in interface com.sun.enterprise.security.common.AppservPasswordLoginModuleInterface
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
Copyright © 2009 Sun Microsystems, Inc. All Rights Reserved. Use is subject to license terms.
Generated on 12-March-2010 04:35