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, org.jboss.security.RunAs

public class RunAsIdentity
extends SimplePrincipal
implements Cloneable, org.jboss.security.RunAs

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

Version:
$Revision: 86122 $
Author:
Thomas.Diesler@jboss.org, Scott.Stark@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<String> extraRoleNames)
          Construct an inmutable instance of a RunAsIdentity
 
Method Summary
 Object clone()
           
 boolean doesUserHaveRole(Principal role)
           
 boolean doesUserHaveRole(Set<Principal> methodRoles)
          True if the run-as principal has any of the method roles
<T> T
getIdentity()
           
 Set<Principal> getPrincipalsSet()
          Return a set with the configured run-as principal and a Group("Roles") with the run-as roles
<T> T
getProof()
           
 Set<Principal> getRunAsRoles()
          Return a set with the configured run-as role
 org.jboss.security.identity.RoleGroup getRunAsRolesAsRoleGroup()
          Return a RoleGroup of Run-As roles
 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
 
Methods inherited from interface java.security.Principal
equals, getName, hashCode
 

Constructor Detail

RunAsIdentity

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


RunAsIdentity

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

Method Detail

getRunAsRoles

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

Returns:
Set for the run-as roles

getRunAsRolesAsRoleGroup

public org.jboss.security.identity.RoleGroup getRunAsRolesAsRoleGroup()
Return a RoleGroup of Run-As roles

Returns:

getPrincipalsSet

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

Returns:
Set for the run-as principal and roles

doesUserHaveRole

public boolean doesUserHaveRole(Principal role)

doesUserHaveRole

public boolean doesUserHaveRole(Set<Principal> 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

getIdentity

public <T> T getIdentity()
Specified by:
getIdentity in interface org.jboss.security.RunAs

getProof

public <T> T getProof()
Specified by:
getProof in interface org.jboss.security.RunAs


Copyright © 2009 JBoss Inc.. All Rights Reserved.