org.objectweb.jonas.security
Class RoleMechanism

java.lang.Object
  |
  +--org.objectweb.jonas.security.RoleMechanism

public class RoleMechanism
extends java.lang.Object

Managed roles defined in jonas-users.properties and check the right access between method roles and principal roles

Author:
Jeff Mesnil

Method Summary
 void addMapping(java.lang.String principalName, java.lang.String[] roles)
          Add the mapping between a principal name and the associated roles
static RoleMechanism getInstance()
          Return the unique instance
 java.util.Hashtable getPrincipalDeclarativeRoleMapping()
          MBean method:
 boolean isCallerInRole(java.security.Principal principal, java.lang.String role)
          Check if the given role match the principal roles
 boolean isCallerInRole(java.security.Principal principal, java.lang.String role, java.lang.String[] pRoles)
          Check if the given role match the principal roles
 boolean isCallerInRoles(java.security.Principal principal, java.lang.String[] roles)
          Check if the given roles match the principal roles
 boolean isCallerInRoles(java.security.Principal principal, java.lang.String[] roles, java.lang.String[] pRoles)
          Check if the given roles match the principal roles
 java.lang.String toString()
          Method toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

getInstance

public static RoleMechanism getInstance()
Return the unique instance
Returns:
RoleMechanism the unique instance

addMapping

public void addMapping(java.lang.String principalName,
                       java.lang.String[] roles)
Add the mapping between a principal name and the associated roles
Parameters:
principalName - name of the principal
roles - roles of the principal

isCallerInRole

public boolean isCallerInRole(java.security.Principal principal,
                              java.lang.String role,
                              java.lang.String[] pRoles)
Check if the given role match the principal roles
Parameters:
principal - principal
role - the given role
pRoles - the roles of the principal
Returns:
boolean true if given role match the principal roles

isCallerInRole

public boolean isCallerInRole(java.security.Principal principal,
                              java.lang.String role)
Check if the given role match the principal roles
Parameters:
principal - principal
role - the given role
Returns:
boolean true if given role match the principal roles

isCallerInRoles

public boolean isCallerInRoles(java.security.Principal principal,
                               java.lang.String[] roles,
                               java.lang.String[] pRoles)
Check if the given roles match the principal roles
Parameters:
principal - principal
roles - the given roles
pRoles - the roles of the principal
Returns:
boolean if given roles match the principal roles

isCallerInRoles

public boolean isCallerInRoles(java.security.Principal principal,
                               java.lang.String[] roles)
Check if the given roles match the principal roles
Parameters:
principal - principal
roles - the given roles
Returns:
boolean if given roles match the principal roles

toString

public java.lang.String toString()
Method toString
Overrides:
toString in class java.lang.Object
Returns:
String a string representation of the object

getPrincipalDeclarativeRoleMapping

public java.util.Hashtable getPrincipalDeclarativeRoleMapping()
MBean method:
Returns:
Hashtable of corepondances between pricipal and declarative roles