org.mortbay.jaas

Class JAASUserRealm

public class JAASUserRealm extends Object implements UserRealm

JAASUserRealm

Notes

Usage

   
Nested Class Summary
protected classJAASUserRealm.UserInfo
UserInfo Information cached for an authenticated user.
Field Summary
protected StringcallbackHandlerClass
protected StringloginModuleName
protected StringrealmName
protected RoleCheckPolicyroleCheckPolicy
protected HashMapuserMap
Constructor Summary
JAASUserRealm()
Constructor.
JAASUserRealm(String name)
Constructor.
Method Summary
Principalauthenticate(String username, Object credentials, HttpRequest request)
Authenticate a user.
voiddisassociate(Principal user)
Removes any auth info associated with eg. the thread.
StringgetName()
Get the name of the realm.
PrincipalgetPrincipal(String username)
booleanisUserInRole(Principal user, String role)
voidlogout(Principal user)
Logout a previously logged in user.
PrincipalpopRole(Principal user)
PrincipalpushRole(Principal user, String role)
Temporarily adds a role to a user.
booleanreauthenticate(Principal user)
voidsetCallbackHandlerClass(String classname)
voidsetLoginModuleName(String name)
Set the name to use to index into the config file of LoginModules.
voidsetName(String name)
Set the name of the realm
voidsetRoleCheckPolicy(RoleCheckPolicy policy)

Field Detail

callbackHandlerClass

protected String callbackHandlerClass

loginModuleName

protected String loginModuleName

realmName

protected String realmName

roleCheckPolicy

protected RoleCheckPolicy roleCheckPolicy

userMap

protected HashMap userMap

Constructor Detail

JAASUserRealm

public JAASUserRealm()
Constructor.

JAASUserRealm

public JAASUserRealm(String name)
Constructor.

Parameters: name the name of the realm

Method Detail

authenticate

public Principal authenticate(String username, Object credentials, HttpRequest request)
Authenticate a user.

Parameters: username provided by the user at login credentials provided by the user at login request a HttpRequest value

Returns: authenticated JAASUserPrincipal or null if authenticated failed

disassociate

public void disassociate(Principal user)
Removes any auth info associated with eg. the thread.

Parameters: user a UserPrincipal to disassociate

getName

public String getName()
Get the name of the realm.

Returns: name or null if not set.

getPrincipal

public Principal getPrincipal(String username)

isUserInRole

public boolean isUserInRole(Principal user, String 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.

Parameters: user an Principal value

popRole

public Principal popRole(Principal user)

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.

Parameters: user the Principal to which to add the role role the role name

Returns: the Principal with the role added

reauthenticate

public boolean reauthenticate(Principal user)

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.

Parameters: name a String value

setName

public void setName(String name)
Set the name of the realm

Parameters: name a String value

setRoleCheckPolicy

public void setRoleCheckPolicy(RoleCheckPolicy policy)
Copyright © 2004 Mortbay Consulting Pty. Ltd. All Rights Reserved.