org.ow2.bonita.identity.auth
Class IdLoginModule

java.lang.Object
  extended by org.ow2.bonita.identity.auth.IdLoginModule
All Implemented Interfaces:
javax.security.auth.spi.LoginModule

public class IdLoginModule
extends java.lang.Object
implements javax.security.auth.spi.LoginModule

Author:
"Pierre Vigneras"

Nested Class Summary
 class IdLoginModule.MissingOptionException
           
 
Field Summary
static java.lang.String AUTH_SERVICE_URL
          Property key used to define the authentication service to use.
static java.lang.String DEBUG_OPTION_NAME
          Property key for the debug flag.
static java.lang.String SERVICE_PARAMS_OPTION_NAME
          Property key used to define service instantiation parameters.
 
Constructor Summary
IdLoginModule()
           
 
Method Summary
 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<java.lang.String,?> sharedState, java.util.Map<java.lang.String,?> options)
          Initialize this LoginModule.
 boolean login()
          Method to authenticate a Subject (phase 1).
 boolean logout()
          Method which logs out a Subject.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

AUTH_SERVICE_URL

public static final java.lang.String AUTH_SERVICE_URL
Property key used to define the authentication service to use. Defined to be "service.impl". Property Value should be the full name of a class that implements the IdentityServiceOp interface.

See Also:
Constant Field Values

SERVICE_PARAMS_OPTION_NAME

public static final java.lang.String SERVICE_PARAMS_OPTION_NAME
Property key used to define service instantiation parameters. Defined to be "service.parameters". Property Value can be any String.

See Also:
Constant Field Values

DEBUG_OPTION_NAME

public static final java.lang.String DEBUG_OPTION_NAME
Property key for the debug flag. Defined to be "debug". Property Value. If set, should be either "true" or "false". Default is "false".

See Also:
Constant Field Values
Constructor Detail

IdLoginModule

public IdLoginModule()
Method Detail

initialize

public void initialize(javax.security.auth.Subject subject,
                       javax.security.auth.callback.CallbackHandler callbackHandler,
                       java.util.Map<java.lang.String,?> sharedState,
                       java.util.Map<java.lang.String,?> options)
Initialize this LoginModule. 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.

Specified by:
initialize in interface javax.security.auth.spi.LoginModule
Parameters:
subject - 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.

login

public boolean login()
              throws javax.security.auth.login.LoginException
Method to authenticate a 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.

Specified by:
login in interface javax.security.auth.spi.LoginModule
Returns:
true if the authentication succeeded, or false if this LoginModule should be ignored.
Throws:
javax.security.auth.login.LoginException - if the authentication fails

commit

public boolean commit()
               throws javax.security.auth.login.LoginException
Method to commit 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 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.

Specified by:
commit in interface javax.security.auth.spi.LoginModule
Returns:
true if this method succeeded, or false if this LoginModule should be ignored.
Throws:
javax.security.auth.login.LoginException - if the commit fails

abort

public boolean abort()
              throws javax.security.auth.login.LoginException
Method to abort 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 login method), then this method cleans up any state that was originally saved.

Specified by:
abort in interface javax.security.auth.spi.LoginModule
Returns:
true if this method succeeded, or false if this LoginModule should be ignored.
Throws:
javax.security.auth.login.LoginException - if the abort fails

logout

public boolean logout()
               throws javax.security.auth.login.LoginException
Method which logs out a Subject. An implementation of this method might remove/destroy a Subject's Principals and Credentials.

Specified by:
logout in interface javax.security.auth.spi.LoginModule
Returns:
true if this method succeeded, or false if this LoginModule should be ignored.
Throws:
javax.security.auth.login.LoginException - if the logout fails


Copyright © 2009 OW2 Consortium. All Rights Reserved.