org.mortbay.jetty.plus.jaas
Class JAASUserPrincipal

java.lang.Object
  extended by org.mortbay.jetty.plus.jaas.JAASUserPrincipal
All Implemented Interfaces:
java.security.Principal

public class JAASUserPrincipal
extends java.lang.Object
implements java.security.Principal

JAASUserPrincipal

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

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

Nested Class Summary
static class JAASUserPrincipal.RoleStack
          RoleStack
 
Constructor Summary
JAASUserPrincipal(JAASUserRealm realm, java.lang.String name)
          Constructor.
 
Method Summary
 void disassociate()
          Clean out any pushed roles that haven't been popped
protected  javax.security.auth.login.LoginContext getLoginContext()
           
 java.lang.String getName()
          Get the name identifying the user
 JAASUserRealm getRealm()
           
 java.security.acl.Group getRoles()
          Determine the roles that the LoginModule has set
 javax.security.auth.Subject getSubject()
          Provide access to the current Subject
 boolean isUserInRole(java.lang.String roleName)
          Check if user is in role
 void popRole()
          Remove temporary association between user and role.
 void pushRole(java.lang.String roleName)
          Temporarily associate a user with a role.
protected  void setLoginContext(javax.security.auth.login.LoginContext loginContext)
           
 void setRoleCheckPolicy(RoleCheckPolicy policy)
          Set the type of checking for isUserInRole
protected  void setSubject(javax.security.auth.Subject subject)
          Sets the JAAS subject for this user.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.security.Principal
equals, hashCode
 

Constructor Detail

JAASUserPrincipal

public JAASUserPrincipal(JAASUserRealm realm,
                         java.lang.String name)
Constructor.

Parameters:
name - the name identifying the user
Method Detail

getRealm

public JAASUserRealm getRealm()

isUserInRole

public boolean isUserInRole(java.lang.String roleName)
Check if user is in role

Parameters:
roleName - role to check
Returns:
true or false accordint to the RoleCheckPolicy.

getRoles

public java.security.acl.Group getRoles()
Determine the roles that the LoginModule has set

Returns:
A Group of Principals representing the roles this user holds

setRoleCheckPolicy

public void setRoleCheckPolicy(RoleCheckPolicy policy)
Set the type of checking for isUserInRole

Parameters:
policy -

pushRole

public void pushRole(java.lang.String roleName)
Temporarily associate a user with a role.

Parameters:
roleName -

popRole

public void popRole()
Remove temporary association between user and role.


disassociate

public void disassociate()
Clean out any pushed roles that haven't been popped


getName

public java.lang.String getName()
Get the name identifying the user

Specified by:
getName in interface java.security.Principal

setSubject

protected void setSubject(javax.security.auth.Subject subject)
Sets the JAAS subject for this user. The subject contains:

getSubject

public javax.security.auth.Subject getSubject()
Provide access to the current Subject


setLoginContext

protected void setLoginContext(javax.security.auth.login.LoginContext loginContext)

getLoginContext

protected javax.security.auth.login.LoginContext getLoginContext()

toString

public java.lang.String toString()
Specified by:
toString in interface java.security.Principal
Overrides:
toString in class java.lang.Object


Copyright © 1995-2009 Mort Bay Consulting. All Rights Reserved.