Top Description Inners Fields Constructors Methods
org.mortbay.jetty.plus.jaas

public Class JAASUserPrincipal

extends Object
implements Principal
Class Inheritance
All Implemented Interfaces
java.security.Principal
Imports
java.security.Principal, java.security.acl.Group, java.util.Stack, javax.security.auth.Subject, javax.security.auth.login.LoginContext

JAASUserPrincipal

Implements the JAAS version of the org.mortbay.http.UserPrincipal interface.

Author
Jan Bartel (janb)
Version
$Id: JAASUserPrincipal.java 1001 2006-09-23 09:31:51Z janb $

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class

Field Summary

Modifier and TypeField and Description
private LoginContext
private String
private JAASUserRealm
private RoleCheckPolicy
private static JAASUserPrincipal.RoleStack
private Subject

Constructor Summary

AccessConstructor and Description
public
JAASUserPrincipal(JAASUserRealm realm, String
the name identifying the user
name
)

Constructor.

Method Summary

Modifier and TypeMethod and Description
public void
disassociate()

Clean out any pushed roles that haven't been popped

protected LoginContext
public String
getName()

Implements java.security.Principal.getName.

Get the name identifying the user
public JAASUserRealm
public java.security.acl.Group

Returns:

A Group of Principals representing the roles this user holds
getRoles
()

Determine the roles that the LoginModule has set

public Subject
getSubject()

Provide access to the current Subject

public boolean

Returns:

true or false accordint to the RoleCheckPolicy.
isUserInRole
(String
role to check
roleName
)

Check if user is in role

public void
popRole()

Remove temporary association between user and role.

public void
pushRole(String roleName)

Temporarily associate a user with a role.

protected void
public void
setRoleCheckPolicy(RoleCheckPolicy policy)

Set the type of checking for isUserInRole

protected void
setSubject(Subject subject)

Sets the JAAS subject for this user.

public String
toString()

Overrides java.lang.Object.toString.

Implements java.security.Principal.toString.

Returns a string representation of this Principal.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

loginContextback to summary
private LoginContext loginContext
nameback to summary
private String name
realmback to summary
private JAASUserRealm realm
roleCheckPolicyback to summary
private RoleCheckPolicy roleCheckPolicy
runAsRolesback to summary
private static JAASUserPrincipal.RoleStack runAsRoles
subjectback to summary
private Subject subject

Constructor Detail

JAASUserPrincipalback to summary
public JAASUserPrincipal(JAASUserRealm realm, String name)

Constructor.

Parameters
name:String

the name identifying the user

Method Detail

disassociateback to summary
public void disassociate()

Clean out any pushed roles that haven't been popped

getLoginContextback to summary
protected LoginContext getLoginContext()
getNameback to summary
public String getName()

Implements java.security.Principal.getName.

Get the name identifying the user

Returns:String

Doc from java.security.Principal.getName.

the name of this Principal.

getRealmback to summary
public JAASUserRealm getRealm()
getRolesback to summary
public java.security.acl.Group getRoles()

Determine the roles that the LoginModule has set

Returns:java.security.acl.Group

A Group of Principals representing the roles this user holds

getSubjectback to summary
public Subject getSubject()

Provide access to the current Subject

isUserInRoleback to summary
public boolean isUserInRole(String roleName)

Check if user is in role

Parameters
roleName:String

role to check

Returns:boolean

true or false accordint to the RoleCheckPolicy.

popRoleback to summary
public void popRole()

Remove temporary association between user and role.

pushRoleback to summary
public void pushRole(String roleName)

Temporarily associate a user with a role.

setLoginContextback to summary
protected void setLoginContext(LoginContext loginContext)
setRoleCheckPolicyback to summary
public void setRoleCheckPolicy(RoleCheckPolicy policy)

Set the type of checking for isUserInRole

setSubjectback to summary
protected void setSubject(Subject subject)

Sets the JAAS subject for this user. The subject contains:

  • the user's credentials
  • Principal for the user's roles
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Implements java.security.Principal.toString.

Doc from java.security.Principal.toString.

Returns a string representation of this Principal.

Returns:String

a string representation of this Principal.

org.mortbay.jetty.plus.jaas back to summary

public Class JAASUserPrincipal.RoleStack

extends Object
Class Inheritance

RoleStack

Field Summary

Modifier and TypeField and Description
private static ThreadLocal<T>

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public static void
public static boolean
public static JAASRole
peek()

public static void
pop()

public static void
push(JAASRole role)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

localback to summary
private static ThreadLocal<T> local

Constructor Detail

RoleStackback to summary
public RoleStack()

Method Detail

clearback to summary
public static void clear()
emptyback to summary
public static boolean empty()
peekback to summary
public static JAASRole peek()
popback to summary
public static void pop()
pushback to summary
public static void push(JAASRole role)