org.objectweb.jonas.security.jacc
Class JPolicyUserRoleMapping

java.lang.Object
  extended byorg.objectweb.jonas.security.jacc.JPolicyUserRoleMapping

public class JPolicyUserRoleMapping
extends java.lang.Object

Helper class to manage user to role mapping It uses the contextId as identifier. For clients, as there is no contextId, this is a per jvm property with contextId equals to "global"

Author:
Florent Benoit

Field Summary
static java.lang.String GLOBAL_CTXID
          Global contextID (per JVM configuration)
 
Method Summary
static void addGlobalUserToRoleMapping(java.lang.String principalName, java.lang.String[] roles)
          Add a mapping for the given principal name (on all JVM)
static void addUserToRoleMapping(java.lang.String contextId, java.lang.String principalName, java.lang.String[] roles)
          Add a mapping for the given principal name
static java.lang.String[] getGlobalMappingForPrincipal(java.lang.String principalName)
          Gets the mapping for a principal name
static java.lang.String[] getMappingForPrincipal(java.lang.String contextId, java.lang.String principalName)
          Gets the mapping for a principal name
static void removeUserToRoleMapping(java.lang.String contextId)
          Remove a mapping for the given context Id
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

GLOBAL_CTXID

public static final java.lang.String GLOBAL_CTXID
Global contextID (per JVM configuration)

See Also:
Constant Field Values
Method Detail

addUserToRoleMapping

public static void addUserToRoleMapping(java.lang.String contextId,
                                        java.lang.String principalName,
                                        java.lang.String[] roles)
Add a mapping for the given principal name

Parameters:
contextId - Id of the application
principalName - mapping for this principal name
roles - roles for the principal

addGlobalUserToRoleMapping

public static void addGlobalUserToRoleMapping(java.lang.String principalName,
                                              java.lang.String[] roles)
Add a mapping for the given principal name (on all JVM)

Parameters:
principalName - mapping for this principal name
roles - roles for the principal

getMappingForPrincipal

public static java.lang.String[] getMappingForPrincipal(java.lang.String contextId,
                                                        java.lang.String principalName)
Gets the mapping for a principal name

Parameters:
contextId - Id of the application
principalName - name of the principal on which we want to retrieve roles
Returns:
array of roles

getGlobalMappingForPrincipal

public static java.lang.String[] getGlobalMappingForPrincipal(java.lang.String principalName)
Gets the mapping for a principal name

Parameters:
principalName - name of the principal on which we want to retrieve roles
Returns:
array of roles

removeUserToRoleMapping

public static void removeUserToRoleMapping(java.lang.String contextId)
Remove a mapping for the given context Id

Parameters:
contextId - Id of the application