no.feide.mellon.jaas.loginmodules
Class MoriaLoginModule

java.lang.Object
  extended by no.feide.mellon.jaas.loginmodules.MoriaLoginModule
All Implemented Interfaces:
javax.security.auth.spi.LoginModule

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

Author:
Rikke Amilde Løvlid

Field Summary
private static java.lang.String[] ATTRIBUTE_NAMES
           
private  javax.security.auth.callback.CallbackHandler callbackHandler
           
private  boolean commitSucceeded
           
private  boolean debug
           
private  java.lang.String endpoint
           
private  boolean loginSucceeded
           
private  java.util.Map options
           
private  java.lang.String service_password
           
private  java.lang.String service_username
           
private  java.util.Map sharedState
           
private  javax.security.auth.Subject subject
           
private  java.util.ArrayList tmpPrincipals
           
private  java.util.ArrayList tmpPublicCredentials
           
private  java.lang.String username
           
 
Constructor Summary
MoriaLoginModule()
           
 
Method Summary
 boolean abort()
          This method is called if the LoginContext's overall authentication failed.
 boolean commit()
          This method is called if the LoginContext's overall authentication succeeded.
 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()
          The login method is called to authenticate the user.
 boolean logout()
          This method removes the principals that was added by the commit method.
private  boolean validate(java.lang.String username, char[] password)
          This method checks the username and password and gets the users attribute values.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

subject

private javax.security.auth.Subject subject

callbackHandler

private javax.security.auth.callback.CallbackHandler callbackHandler

sharedState

private java.util.Map sharedState

options

private java.util.Map options

loginSucceeded

private boolean loginSucceeded

commitSucceeded

private boolean commitSucceeded

username

private java.lang.String username

tmpPrincipals

private java.util.ArrayList tmpPrincipals

tmpPublicCredentials

private java.util.ArrayList tmpPublicCredentials

debug

private boolean debug

ATTRIBUTE_NAMES

private static final java.lang.String[] ATTRIBUTE_NAMES

endpoint

private java.lang.String endpoint

service_username

private java.lang.String service_username

service_password

private java.lang.String service_password
Constructor Detail

MoriaLoginModule

public MoriaLoginModule()
Method Detail

initialize

public void initialize(javax.security.auth.Subject subject,
                       javax.security.auth.callback.CallbackHandler callbackHandler,
                       java.util.Map sharedState,
                       java.util.Map options)
Initialize this LoginModule

Specified by:
initialize in interface javax.security.auth.spi.LoginModule
Parameters:
subject - the Subject to be authenticated.
callbackHandler - a CallbackHandler for communicating with the user, (promting for username and password)
sharedState - state shared with the other LoginModule
options - options specified in the login Configuration for this particular LoginModule

login

public boolean login()
              throws javax.security.auth.login.LoginException
The login method is called to authenticate the user.

Specified by:
login in interface javax.security.auth.spi.LoginModule
Returns:
true if the authentication succeedes (no exception is thrown).
Throws:
javax.security.auth.login.FailedLoginException - if authentication failes.
javax.security.auth.login.LoginException - if this LoginModule is unable to perform the uthentication.

commit

public boolean commit()
               throws javax.security.auth.login.LoginException
This method is called if the LoginContext's overall authentication succeeded.

Specified by:
commit in interface javax.security.auth.spi.LoginModule
Returns:
true if this loginmodules own login attempt succeded and commit succeeds,
Throws:
javax.security.auth.login.LoginException - if the commit attempt failes.

abort

public boolean abort()
              throws javax.security.auth.login.LoginException
This method is called if the LoginContext's overall authentication failed.

Specified by:
abort in interface javax.security.auth.spi.LoginModule
Returns:
false if this loginmodules own login attempts failed
Throws:
javax.security.auth.login.LoginException - if the abort failes

logout

public boolean logout()
               throws javax.security.auth.login.LoginException
This method removes the principals that was added by the commit method.

Specified by:
logout in interface javax.security.auth.spi.LoginModule
Returns:
true in all cases.
Throws:
javax.security.auth.login.LoginException - if the logout fails.

validate

private boolean validate(java.lang.String username,
                         char[] password)
This method checks the username and password and gets the users attribute values.

Parameters:
username -
password -
Returns:
true if username and password are correct and false if there are som exception or the username and/or password not is correct.


Copyright © 2001-2006 UNINETT FAS. All Rights Reserved.