org.jboss.security
Class RunAsIdentity

java.lang.Object
  extended by org.jboss.security.SimplePrincipal
      extended by org.jboss.security.RunAsIdentity
All Implemented Interfaces:
Serializable, Cloneable, Principal

public class RunAsIdentity
extends SimplePrincipal
implements Cloneable

The RunAsIdentity is a Principal that associates the run-as principal with his run-as role(s).

Version:
$Revision: 57203 $
Author:
Thomas.Diesler@jboss.org, Anil.Saldhana@jboss.org
See Also:
Serialized Form

Constructor Summary
RunAsIdentity(String roleName, String principalName)
          Construct an inmutable instance of a RunAsIdentity
RunAsIdentity(String roleName, String principalName, Set extraRoleNames)
          Construct an inmutable instance of a RunAsIdentity
 
Method Summary
 Object clone()
           
 boolean doesUserHaveRole(Principal role)
           
 boolean doesUserHaveRole(Set methodRoles)
          True if the run-as principal has any of the method roles
 Set getPrincipalsSet()
          Return a set with the configured run-as principal and a Group("Roles") with teh run-as roles
 Set getRunAsRoles()
          Return a set with the configured run-as role
 String toString()
          Returns a string representation of the object.
 
Methods inherited from class org.jboss.security.SimplePrincipal
equals, getName, hashCode
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RunAsIdentity

public RunAsIdentity(String roleName,
                     String principalName)
Construct an inmutable instance of a RunAsIdentity


RunAsIdentity

public RunAsIdentity(String roleName,
                     String principalName,
                     Set extraRoleNames)
Construct an inmutable instance of a RunAsIdentity

Method Detail

getRunAsRoles

public Set getRunAsRoles()
Return a set with the configured run-as role

Returns:
Set for the run-as roles

getPrincipalsSet

public Set getPrincipalsSet()
Return a set with the configured run-as principal and a Group("Roles") with teh run-as roles

Returns:
Set for the run-as principal and roles

doesUserHaveRole

public boolean doesUserHaveRole(Principal role)

doesUserHaveRole

public boolean doesUserHaveRole(Set methodRoles)
True if the run-as principal has any of the method roles


toString

public String toString()
Returns a string representation of the object.

Specified by:
toString in interface Principal
Overrides:
toString in class SimplePrincipal
Returns:
a string representation of the object.

clone

public Object clone()
             throws CloneNotSupportedException
Overrides:
clone in class Object
Throws:
CloneNotSupportedException


Copyright © 2002 JBoss Group, LLC. All Rights Reserved.