org.mortbay.jaas
Class JAASUserRealm
java.lang.Object
org.mortbay.jaas.JAASUserRealm
- UserRealm
public class JAASUserRealm
extends java.lang.Object
JAASUserRealm
Notes
Usage
callbackHandlerClass
protected String callbackHandlerClass
loginModuleName
protected String loginModuleName
realmName
protected String realmName
userMap
protected HashMap userMap
JAASUserRealm
public JAASUserRealm()
Constructor.
JAASUserRealm
public JAASUserRealm(String name)
Constructor.
name
- the name of the realm
authenticate
public Principal authenticate(String username,
Object credentials,
HttpRequest request)
Authenticate a user.
- authenticate in interface UserRealm
username
- provided by the user at logincredentials
- provided by the user at loginrequest
- a HttpRequest
value
- authenticated JAASUserPrincipal or null if authenticated failed
disassociate
public void disassociate(Principal user)
Removes any auth info associated with eg. the thread.
- disassociate in interface UserRealm
user
- a UserPrincipal to disassociate
getName
public String getName()
Get the name of the realm.
- getName in interface UserRealm
getPrincipal
public Principal getPrincipal(String username)
Get the principal for a username.
This method is not guaranteed to return a Principal for non-authenticated users.
- getPrincipal in interface UserRealm
isUserInRole
public boolean isUserInRole(Principal user,
String role)
Check if the user is in a role.
- isUserInRole in interface UserRealm
- True if the user can act in that role.
logout
public void logout(Principal user)
Logout a previously logged in user.
This can only work for FORM authentication
as BasicAuthentication is stateless.
The user's LoginContext logout() method is called.
- logout in interface UserRealm
user
- an Principal
value
popRole
public Principal popRole(Principal user)
Pop role from a Principal.
- popRole in interface UserRealm
user
- A UserPrincipal previously returned from pushRole
- The principal without the role. Most often this will be the
original UserPrincipal passed.
pushRole
public Principal pushRole(Principal user,
String role)
Temporarily adds a role to a user.
Temporarily granting a role pushes the role onto a stack
of temporary roles. Temporary roles must therefore be
removed in order.
- pushRole in interface UserRealm
user
- the Principal to which to add the rolerole
- the role name
- the Principal with the role added
reauthenticate
public boolean reauthenticate(Principal user)
Re Authenticate a Principal.
Authenicate a principal that has previously been return from the authenticate method.
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.
- reauthenticate in interface UserRealm
- True if this user is still authenticated.
setCallbackHandlerClass
public void setCallbackHandlerClass(String classname)
setLoginModuleName
public void setLoginModuleName(String name)
Set the name to use to index into the config
file of LoginModules.
setName
public void setName(String name)
Set the name of the realm
Copyright © 2004 Mortbay Consulting Pty. Ltd. All Rights Reserved.