org.mortbay.jaas
Class JAASUserRealm

java.lang.Object
  |
  +--org.mortbay.jaas.JAASUserRealm
All Implemented Interfaces:
UserRealm

public class JAASUserRealm
extends java.lang.Object
implements UserRealm

JAASUserRealm

Notes

Usage


Constructor Summary
JAASUserRealm()
           
JAASUserRealm(java.lang.String name)
           
 
Method Summary
 UserPrincipal authenticate(java.lang.String username, java.lang.Object credentials, HttpRequest request)
          Authenticate a users credentials.
 void disassociate(UserPrincipal user)
          Dissassociate the calling context with a Principal.
 java.lang.String getName()
           
 UserPrincipal popRole(UserPrincipal user)
          Pop role from a Principal.
 UserPrincipal pushRole(UserPrincipal user, java.lang.String role)
          Push role onto a Principal.
 void setCallbackHandler(AbstractCallbackHandler handler)
           
 void setLoginModuleName(java.lang.String name)
           
 void setName(java.lang.String name)
           
 void setRoleCheckPolicy(RoleCheckPolicy policy)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JAASUserRealm

public JAASUserRealm()

JAASUserRealm

public JAASUserRealm(java.lang.String name)
Method Detail

getName

public java.lang.String getName()
Specified by:
getName in interface UserRealm

setName

public void setName(java.lang.String name)

setLoginModuleName

public void setLoginModuleName(java.lang.String name)

setCallbackHandler

public void setCallbackHandler(AbstractCallbackHandler handler)

setRoleCheckPolicy

public void setRoleCheckPolicy(RoleCheckPolicy policy)

authenticate

public UserPrincipal authenticate(java.lang.String username,
                                  java.lang.Object credentials,
                                  HttpRequest request)
Description copied from interface: UserRealm
Authenticate a users credentials. Implementations of this method may adorn the calling context to assoicate it with the authenticated principal (eg ThreadLocals). If such context associations are made, they should be considered valid until a UserRealm.deAuthenticate(UserPrincipal) call is made for this UserPrincipal.

Specified by:
authenticate in interface UserRealm
Parameters:
username - The username.
credentials - The user credentials, normally a String password.
request - The request to be authenticated. Additional parameters may be extracted or set on this request as needed for the authentication mechanism (none required for BASIC and FORM authentication).
Returns:
The authenticated UserPrincipal.

disassociate

public void disassociate(UserPrincipal user)
Description copied from interface: UserRealm
Dissassociate the calling context with a Principal. This method is called when the calling context is not longer associated with the Principal. It should be used by an implementation to remove context associations such as ThreadLocals. The UserPrincipal object remains authenticated, as it may be associated with other contexts.

Specified by:
disassociate in interface UserRealm
Parameters:
user - A UserPrincipal allocated from this realm.

pushRole

public UserPrincipal pushRole(UserPrincipal user,
                              java.lang.String role)
Description copied from interface: UserRealm
Push role onto a Principal. This method is used to add a role to an existing principal.

Specified by:
pushRole in interface UserRealm
Parameters:
user - An existing UserPrincipal or null for an anonymous user.
role - The role to add.
Returns:
A new UserPrincipal object that wraps the passed user, but with the added role.

popRole

public UserPrincipal popRole(UserPrincipal user)
Description copied from interface: UserRealm
Pop role from a Principal.

Specified by:
popRole in interface UserRealm
Parameters:
user - A UserPrincipal previously returned from pushRole
Returns:
The principal without the role. Most often this will be the original UserPrincipal passed.


Copyright © 2000 Mortbay Consulting Pty. Ltd. All Rights Reserved.