tyrex.security.container.helper
Class RolesRealm

java.lang.Object
  extended bytyrex.security.container.helper.RolesRealm
Direct Known Subclasses:
LDAPRealm

public class RolesRealm
extends java.lang.Object

Cached copy of a realm and all the roles in that realm. Implementations of realms can extend this class and use it to add roles, list members in roles, lookup roles and members in roles, and construct RoleCredentials.

Version:
$Revision: 1.5 $ $Date: 2001/03/19 17:39:02 $
Author:
Assaf Arkin

Nested Class Summary
(package private) static class RolesRealm.Role
          Definition of a role is a name and members list.
 
Constructor Summary
protected RolesRealm(java.lang.String realmName, java.lang.String[] defaultRoles)
          Construct a new realm.
 
Method Summary
protected  void addRole(java.lang.String roleName, java.lang.String[] members)
          Add a role or members to an existing role.
 java.lang.String getRealmName()
          Returns the name of this realm.
 RoleCredentials getRoleCredentials(java.lang.String member)
          Returns a role credentials for the given member.
 java.lang.String[] listMembers(java.lang.String roleName)
          Lists all the members in the role.
 java.lang.String[] listRoles()
          Lists all the roles in this realm.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RolesRealm

protected RolesRealm(java.lang.String realmName,
                     java.lang.String[] defaultRoles)
Construct a new realm.

Parameters:
realmName - The realm name
defaultRoles - List of default roles that all members are listed in, or null if no default roles
Method Detail

getRealmName

public java.lang.String getRealmName()
Returns the name of this realm.

Returns:
Name of realm

listRoles

public java.lang.String[] listRoles()
Lists all the roles in this realm.

Returns:
Array of zero or more roles

listMembers

public java.lang.String[] listMembers(java.lang.String roleName)
Lists all the members in the role.

Parameters:
roleName - The role name
Returns:
Array of zero or more members

addRole

protected void addRole(java.lang.String roleName,
                       java.lang.String[] members)
Add a role or members to an existing role. If the role did not exist before, the role and all its members are added to the role list. If the role existed before, the members are added to the existing list of members.

Parameters:
roleName - The role name
members - The members list

getRoleCredentials

public RoleCredentials getRoleCredentials(java.lang.String member)
Returns a role credentials for the given member. The credentials is constructed by accumulating all the roles in which the member is listed as a member.

Parameters:
member - The member
Returns:
Role credentials


Original code is Copyright (c) 1999-2001, Intalio, Inc. All Rights Reserved. Contributions by MetaBoss team are Copyright (c) 2003-2005, Softaris Pty. Ltd. All Rights Reserved.