public class JpamLoginModule
extends java.lang.Object
implements javax.security.auth.spi.LoginModule
LoginModule which invokes JPAM. This can be used from standard
JAAS implementations. It is an alternative to directly using the Pam class.
This class relies on the existence of a .java.login.config with a login configuration
called net-sf-jpam. Copy the .java.login.config in the src/config/| Constructor and Description |
|---|
JpamLoginModule() |
| Modifier and Type | Method and Description |
|---|---|
boolean |
abort()
Method to abort the authentication process (phase 2).
|
boolean |
commit()
Method to commit the authentication process (phase 2).
|
void |
initialize(javax.security.auth.Subject subject,
javax.security.auth.callback.CallbackHandler callbackHandler,
java.util.Map sharedState,
java.util.Map options)
Initialize this LoginModule.
|
boolean |
login()
Method to authenticate a
Subject (phase 1). |
boolean |
logout()
Method which logs out a
Subject. |
public boolean abort()
throws javax.security.auth.login.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 javax.security.auth.spi.LoginModuleLoginModule should be ignored.javax.security.auth.login.LoginException - if the abort failspublic boolean commit()
throws javax.security.auth.login.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 javax.security.auth.spi.LoginModuleLoginModule should be ignored.javax.security.auth.login.LoginException - if the commit failspublic boolean login()
throws javax.security.auth.login.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 javax.security.auth.spi.LoginModuleLoginModule should be ignored.javax.security.auth.login.LoginException - if the authentication failspublic boolean logout()
throws javax.security.auth.login.LoginException
Subject.
An implementation of this method might remove/destroy a Subject's Principals and Credentials.
logout in interface javax.security.auth.spi.LoginModuleLoginModule should be ignored.javax.security.auth.login.LoginException - if the logout failspublic void initialize(javax.security.auth.Subject subject,
javax.security.auth.callback.CallbackHandler callbackHandler,
java.util.Map sharedState,
java.util.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 javax.security.auth.spi.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.