org.mortbay.jaas

Class JAASUserPrincipal

Implemented Interfaces:
Principal

public class JAASUserPrincipal
extends java.lang.Object
implements 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(String name)
Constructor.

Method Summary

void
disassociate()
Clean out any pushed roles that haven't been popped
String
getName()
Get the name identifying the user
Group
getRoles()
Determine the roles that the LoginModule has set
Subject
getSubject()
Provide access to the current Subject
boolean
isUserInRole(String roleName)
Check if user is in role
void
popRole()
Remove temporary association between user and role.
void
pushRole(String roleName)
Temporarily associate a user with a role.
void
setRoleCheckPolicy(RoleCheckPolicy policy)
Set the type of checking for isUserInRole
protected void
setSubject(Subject subject)
Sets the JAAS subject for this user.

Constructor Details

JAASUserPrincipal

public JAASUserPrincipal(String name)
Constructor.
Parameters:
name - the name identifying the user

Method Details

disassociate

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

getName

public String getName()
Get the name identifying the user
Returns:

getRoles

public Group getRoles()
Determine the roles that the LoginModule has set
Returns:

getSubject

public Subject getSubject()
Provide access to the current Subject
Returns:

isUserInRole

public boolean isUserInRole(String roleName)
Check if user is in role
Parameters:
roleName - role to check
Returns:
true or false accordint to the RoleCheckPolicy.

popRole

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

pushRole

public void pushRole(String roleName)
Temporarily associate a user with a role.
Parameters:
roleName -

setRoleCheckPolicy

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

setSubject

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
Parameters:
subject -

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