issrg.pba.rbac
Class RoleBasedCredentials

java.lang.Object
  extended by issrg.pba.rbac.SubsetCredentials
      extended by issrg.pba.rbac.RoleBasedCredentials
All Implemented Interfaces:
Credentials, Role, java.lang.Cloneable
Direct Known Subclasses:
PermisCredentials

public class RoleBasedCredentials
extends SubsetCredentials
implements Role

This is the implementation of a credential for a role based scheme. It implements the Role interface.

Version:
0.2
Author:
E Ball, D Chadwick, A Otenko

Field Summary
protected  java.lang.String roleType
           
 
Constructor Summary
protected RoleBasedCredentials()
           
  RoleBasedCredentials(java.lang.String roleType, java.lang.Object roleValue)
          This constructor builds the object by specifying the Role type and value.
 
Method Summary
 java.lang.Object clone()
          This method creates a copy of the RoleBasedCredential
 boolean contains(Credentials c)
          This method implements comparison of a credential to this object.
 java.lang.String getRoleType()
          This method returns the type of the role.
 java.lang.Object getRoleValue()
          This method returns the value of the role.
static java.util.Vector getRoleValues(Credentials creds, java.lang.String type)
          This method retrieves all the Role Values of a particular type the user has got.
static RoleBasedCredentials newCredentials(java.lang.String roleType, java.lang.String roleValue)
          Utility method to help build Role Based Credentials out of two strings.
 java.lang.String toString()
           
 
Methods inherited from class issrg.pba.rbac.SubsetCredentials
equals, intersection, union
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

roleType

protected java.lang.String roleType
Constructor Detail

RoleBasedCredentials

protected RoleBasedCredentials()

RoleBasedCredentials

public RoleBasedCredentials(java.lang.String roleType,
                            java.lang.Object roleValue)
This constructor builds the object by specifying the Role type and value.

Parameters:
roleType - is the String name of the Role type, as specified in the Policy XML
roleValue - is the object representing the value of the Role
Throws:
java.lang.IllegalArgumentException - if the parameters to the constructor are semantically incorrect
Method Detail

newCredentials

public static RoleBasedCredentials newCredentials(java.lang.String roleType,
                                                  java.lang.String roleValue)
Utility method to help build Role Based Credentials out of two strings.

Parameters:
roleType - - the role type
roleValue - - the value of the role
Returns:
RoleBasedCredentials object, representing the role of the given type and value

getRoleType

public java.lang.String getRoleType()
This method returns the type of the role.

Specified by:
getRoleType in interface Role
Returns:
String name of the type

getRoleValue

public java.lang.Object getRoleValue()
This method returns the value of the role.

Specified by:
getRoleValue in interface Role
Returns:
the object representing the value of the Role

clone

public java.lang.Object clone()
This method creates a copy of the RoleBasedCredential

Specified by:
clone in interface Credentials
Specified by:
clone in class SubsetCredentials
Returns:
a new RoleBasedCredential with the same properties as the original object

contains

public boolean contains(Credentials c)
This method implements comparison of a credential to this object.

This is a basic Credential, which is unaware of any Role Hierarchy. Therefore, this method is the same as equals.

Specified by:
contains in interface Credentials
Overrides:
contains in class SubsetCredentials
Parameters:
c - is the credential to compare to
Returns:
true if c is contained within this object; false otherwise
See Also:
SetOfSubsetsCredentials

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getRoleValues

public static java.util.Vector getRoleValues(Credentials creds,
                                             java.lang.String type)
This method retrieves all the Role Values of a particular type the user has got.

Example:

Vector roleValues = RoleBasedCredentials.getRoleValues(subject.exportCreds(), "whatEverRoleTypeYouWant");

Parameters:
creds - is the set of credentials to look though
type - is a case-sensitive string name of the required role type, or null, if roles of all types should be returned
Returns:
a vector of values of the role type the caller passed; if is empty, there were no roles of this type