org.mortbay.jaas
Class JAASUserPrincipal

java.lang.Object
  extended by org.mortbay.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,v 1.6 2004/07/01 19:12:08 janb Exp $
Author:
Jan Bartel (janb)

Nested Class Summary
static class JAASUserPrincipal.RoleStack
          RoleStack
 
Constructor Summary
JAASUserPrincipal(java.lang.String name)
          Constructor.
 
Method Summary
 void disassociate()
          Clean out any pushed roles that haven't been popped
 java.lang.String getName()
          Get the name identifying the user
 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.
 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.security.Principal
equals, hashCode, toString
 

Constructor Detail

JAASUserPrincipal

public JAASUserPrincipal(java.lang.String name)
Constructor.

Parameters:
name - the name identifying the user
Method Detail

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:

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
Returns:

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

Returns:


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