Class JAASLoginModule
- java.lang.Object
-
- com.ibm.security.auth.module.JAASLoginModule
-
- All Implemented Interfaces:
- LoginModule
public class JAASLoginModule extends java.lang.Object implements LoginModule
This
JAASLoginModuleclass provides a login module to authenticate OS/390 users with RACF using OS/390 principals and RACF password credentials. RACF PassTickets are not supported. As a result of a successful login, aPrincipal,com.ibm.security.auth.UsernamePrincipalwill be assigned to theSubject.One use of this capability might be to log in as a a particlur user and then perform a
ThreadSubject.doAs((LoginContext)lc.getSubject(), PrivilegedAction there>. This would run the PrivilegedAction as that user, from the perspective of both JAVA and OS/390.This
LoginModulemay actually be used in either of two ways. If no CallbackHandlers were specified on the creation of the code>LoginContext that is constructing thisLoginModulethen this queries the underlying OS for the current identity. If, however, CallbackHandlers were specified, then thisLoginModuledrives aNameCallbackand aPasswordCallbackto get enough information to perform an OS-level login.This LoginModule recognizes the debug option. If set to true in the login module Configuration, debug messages will be output to the output stream, System.out.
This LoginModule does not share state information.
- See Also:
LoginModule
-
-
Constructor Summary
Constructors Constructor and Description JAASLoginModule()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description booleanabort()Abort the authentication process (phase 2).booleancommit()Commit the authentication process (phase 2).voidinitialize(Subject subject, CallbackHandler callbackHandler, java.util.Map sharedState, java.util.Map options)Initialize thisLoginModule.booleanlogin()Authenticate a Subject (phase 1).booleanlogout()Logout the user.
-
-
-
Method Detail
-
initialize
public void initialize(Subject subject, CallbackHandler callbackHandler, java.util.Map sharedState, java.util.Map options)
Initialize thisLoginModule.- Specified by:
initializein interfaceLoginModule- Parameters:
subject- TheSubjectto be authenticated.callbackHandler- ACallbackHandlerfor communicating with the end user (i.e. prompting for usernames and passwords).sharedState- State shared with other configuredLoginModules (ignored)options- Options specified in the loginConfigurationfor for this particularLoginModule.
-
login
public boolean login() throws LoginExceptionAuthenticate a Subject (phase 1).If no CallbackHandlers were specified on the creation of the code>LoginContext that is constructing this
LoginModulethen this queries the underlying OS for the current identity and creates aUsernamePrincipal.If CallbackHandlers were specified on the creation of the code>LoginContext that is constructing this
LoginModulethen this method authenticates a Subject by obtaining a user id and a RACF password via the CallBackHandler, verifies the information with RACF, and creates aUsernamePrincipalif successful. RACF PassTickets are not supported.This method saves the result of the authentication process as private state.
- Specified by:
loginin interfaceLoginModule- Returns:
- true if authentication is successful; false if it is not.
- Throws:
FailedLoginException- If the authentication fails.LoginException- If thisLoginModuleis unable to perform the authentication.
-
commit
public boolean commit() throws LoginExceptionCommit the authentication process (phase 2).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
loginmethod), then this method associates aUsernamePrincipalwith theSubjectlocated in theLoginModuleContext. If this LoginModule's own authentication attempted failed, then this method removes any state that was originally saved.- Specified by:
commitin interfaceLoginModule- Returns:
- true if this LoginModule's own login and commit attempts succeeded, or false otherwise.
- Throws:
LoginException- If the commit fails.
-
abort
public boolean abort() throws LoginExceptionAbort the authentication process (phase 2).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
loginandcommitmethods), then this method cleans up any state that was originally saved.- Specified by:
abortin interfaceLoginModule- Returns:
- false if this LoginModule's own login and/or commit attempts failed, and true otherwise.
- Throws:
LoginException- If the abort fails.
-
logout
public boolean logout() throws LoginExceptionLogout the user.This method removes the
UsernamePrincipalthat may have been added by thecommitmethod.- Specified by:
logoutin interfaceLoginModule- Returns:
- true in all cases.
- Throws:
LoginException- If the logout fails.
-
-