SK.gnome.dwarf.auth
Class JAASAuthenticator

java.lang.Object
  extended bySK.gnome.dwarf.GenericService
      extended bySK.gnome.dwarf.auth.JAASAuthenticator
All Implemented Interfaces:
Authenticator, Reportable, Service

public class JAASAuthenticator
extends GenericService
implements Authenticator, Reportable

Defines the login module-based authentication service.

It uses the javax.security.auth.login package to login and logout the subjects.


Field Summary
 
Fields inherited from class SK.gnome.dwarf.GenericService
initParameters, parent
 
Fields inherited from interface SK.gnome.dwarf.Service
INITIALIZED, LOG_DEBUG, LOG_ERROR, LOG_FATAL, LOG_INFO, LOG_TRACE, LOG_WARN, LOG_XFER, SHUTDOWN, STARTED, STOPPED
 
Constructor Summary
JAASAuthenticator(java.lang.String name)
          Creates a new JAASAuthenticator.
 
Method Summary
 AuthId login(java.lang.String facility, javax.security.auth.Subject subject, javax.security.auth.callback.CallbackHandler handler)
          Authenticates the subject.
 void logout(java.lang.String facility, AuthId id, javax.security.auth.Subject subject)
          Logouts the subject.
 java.lang.String report()
          Returns the service report.
 
Methods inherited from class SK.gnome.dwarf.GenericService
getAuthenticator, getAuthFacility, getFullName, getInitParameter, getInitParameterNames, getLogFacility, getLogger, getName, getParameters, getPrincipal, getShutdownTimeout, getState, init, log, log, login, logout, setAuthFacility, setInitParameters, setLogFacility, shutdown, start, stop, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

JAASAuthenticator

public JAASAuthenticator(java.lang.String name)
Creates a new JAASAuthenticator.

Method Detail

login

public AuthId login(java.lang.String facility,
                    javax.security.auth.Subject subject,
                    javax.security.auth.callback.CallbackHandler handler)
             throws javax.security.auth.login.LoginException
Authenticates the subject.

A new LoginContext is instantiated with the facility, subject and handler arguments and the LoginContext.login() method is invoked. The LoginContext instance is stored internally, referenced by the AuthId object key.

Specified by:
login in interface Authenticator
Parameters:
facility - the authentication facility
subject - the subject to log in
handler - the callback handler
Returns:
the authentication identifier
Throws:
javax.security.auth.login.LoginException - if the login operation fails

logout

public void logout(java.lang.String facility,
                   AuthId id,
                   javax.security.auth.Subject subject)
            throws javax.security.auth.login.LoginException
Logouts the subject.

The stored LoginContext instance is obtained by the AuthId object key and the LoginContext.logout() method is invoked. Then the LoginContext instance is removed from the internal store.

The facility argument is ignored by this method since the LoginContext object is directly accessible by the given id key.

Specified by:
logout in interface Authenticator
Parameters:
facility - the authentication facility
id - the authentication identifier
subject - the subject to log out
Throws:
javax.security.auth.login.LoginException - if the logout operation fails

report

public java.lang.String report()
Returns the service report.

Returns the current/peak/total number of the active LoginContext instances.

Specified by:
report in interface Reportable
Returns:
current service state in a human-readable format


Copyright (c) 1999-2005, Gnome Ltd. All rights reserved.