|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.cafesoft.cams.auth.login.module.X509CertificateLdapLoginModule
public class X509CertificateLdapLoginModule
X509CertificateLdapLoginModule implements a JAAS LoginModule
that uses LDAP to authenticate a user presenting a username, password, and an
X509 client certificate.
This LoginModule attempts to bind to a user-specific LDAP DN which may be constructed by substituting the value of configuration option "userDN" with a username parameter. The LDAP bind is attempted using the user-specified password, but only if all three authentication callback parameters are present.
If the LDAP bind succeeds, the LDAP userCertificate attribute is compared with the X509 certificate presented by the client. If the certificates match (exactly), then the first phase of the login transaction continues to assignment of roles, else login fails due an invalid certificate.
Role assignment is accomplished by use of an LDAP role filter, which queries Groups to which the user assigned and maps them directly to roles.
The following configuration options are available:
Subject,
CallbackHandler,
LoginModule| Constructor Summary | |
|---|---|
X509CertificateLdapLoginModule()
Default X509CertificateLdapLoginModule Constructor. |
|
| Method Summary | |
|---|---|
boolean |
abort()
Method to abort the authentication process (phase 2). |
boolean |
commit()
Method to commit the authentication process (phase 2). |
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. |
void |
setLogger(Logger logger)
Sets the logger. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public X509CertificateLdapLoginModule()
| Method Detail |
|---|
public void setLogger(Logger logger)
setLogger in interface LoggerClientlogger - logs messages
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 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 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 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 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
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||