org.apache.catalina.realm

Class JAASMemoryLoginModule

public class JAASMemoryLoginModule extends MemoryRealm implements LoginModule, Realm

Implementation of the JAAS LoginModule interface, primarily for use in testing JAASRealm. It utilizes an XML-format data file of username/password/role information identical to that supported by org.apache.catalina.realm.MemoryRealm (except that digested passwords are not supported).

This class recognizes the following string-valued options, which are specified in the configuration file (and passed to our constructor in the options argument:

IMPLEMENTATION NOTE - This class implements Realm only to satisfy the calling requirements of the GenericPrincipal constructor. It does not actually perform the functionality required of a Realm implementation.

Version: $Revision: 692717 $ $Date: 2008-09-06 21:52:56 +0200 (Sat, 06 Sep 2008) $

Author: Craig R. McClanahan

Field Summary
protected CallbackHandlercallbackHandler
The callback handler responsible for answering our requests.
protected booleancommitted
Has our own commit() returned successfully?
protected Mapoptions
The configuration information for this LoginModule.
protected Stringpathname
The absolute or relative pathname to the XML configuration file.
protected Principalprincipal
The Principal identified by our validation, or null if validation falied.
protected HashMapprincipals
The set of Principals loaded from our configuration file.
protected MapsharedState
The state information that is shared with other configured LoginModule instances.
protected static StringManagersm
The string manager for this package.
protected Subjectsubject
The subject for which we are performing authentication.
Constructor Summary
JAASMemoryLoginModule()
Method Summary
booleanabort()
Phase 2 of authenticating a Subject when Phase 1 fails.
booleancommit()
Phase 2 of authenticating a Subject when Phase 1 was successful.
SecurityConstraint[]findSecurityConstraints(Request request, Context context)
Return the SecurityConstraints configured to guard the request URI for this request, or null if there is no such constraint.
voidinitialize(Subject subject, CallbackHandler callbackHandler, Map sharedState, Map options)
Initialize this LoginModule with the specified configuration information.
protected voidload()
Load the contents of our configuration file.
booleanlogin()
Phase 1 of authenticating a Subject.
booleanlogout()
Log out this user.

Field Detail

callbackHandler

protected CallbackHandler callbackHandler
The callback handler responsible for answering our requests.

committed

protected boolean committed
Has our own commit() returned successfully?

options

protected Map options
The configuration information for this LoginModule.

pathname

protected String pathname
The absolute or relative pathname to the XML configuration file.

principal

protected Principal principal
The Principal identified by our validation, or null if validation falied.

principals

protected HashMap principals
The set of Principals loaded from our configuration file.

sharedState

protected Map sharedState
The state information that is shared with other configured LoginModule instances.

sm

protected static StringManager sm
The string manager for this package.

subject

protected Subject subject
The subject for which we are performing authentication.

Constructor Detail

JAASMemoryLoginModule

public JAASMemoryLoginModule()

Method Detail

abort

public boolean abort()
Phase 2 of authenticating a Subject when Phase 1 fails. This method is called if the LoginContext failed somewhere in the overall authentication chain.

Returns: true if this method succeeded, or false if this LoginModule should be ignored

Throws: LoginException if the abort fails

commit

public boolean commit()
Phase 2 of authenticating a Subject when Phase 1 was successful. This method is called if the LoginContext succeeded in the overall authentication chain.

Returns: true if the authentication succeeded, or false if this LoginModule should be ignored

Throws: LoginException if the commit fails

findSecurityConstraints

public SecurityConstraint[] findSecurityConstraints(Request request, Context context)
Return the SecurityConstraints configured to guard the request URI for this request, or null if there is no such constraint.

Parameters: request Request we are processing context Context the Request is mapped to

initialize

public void initialize(Subject subject, CallbackHandler callbackHandler, Map sharedState, Map options)
Initialize this LoginModule with the specified configuration information.

Parameters: subject The Subject to be authenticated callbackHandler A CallbackHandler for communicating with the end user as necessary sharedState State information shared with other LoginModule instances options Configuration information for this specific LoginModule instance

load

protected void load()
Load the contents of our configuration file.

login

public boolean login()
Phase 1 of authenticating a Subject.

Returns: true if the authentication succeeded, or false if this LoginModule should be ignored

Throws: LoginException if the authentication fails

logout

public boolean logout()
Log out this user.

Returns: true in all cases because thie LoginModule should not be ignored

Throws: LoginException if logging out failed

Copyright © 2000-2011 Apache Software Foundation. All Rights Reserved.