org.ow2.jonas.lib.security.mapping
Class JPolicyUserRoleMapping

java.lang.Object
  extended by org.ow2.jonas.lib.security.mapping.JPolicyUserRoleMapping

public class JPolicyUserRoleMapping
extends 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 String GLOBAL_CTXID
          Global contextID (per JVM configuration)
 
Method Summary
static void addGlobalUserToRoleMapping(String principalName, String[] roles)
          Add a mapping for the given principal name (on all JVM)
static void addUserToRoleMapping(String contextId, String principalName, String[] roles)
          Add a mapping for the given principal name
static String[] getGlobalMappingForPrincipal(String principalName)
          Gets the mapping for a principal name
static String[] getMappingForPrincipal(String contextId, String principalName)
          Gets the mapping for a principal name
static void removeUserToRoleMapping(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 String GLOBAL_CTXID
Global contextID (per JVM configuration)

See Also:
Constant Field Values
Method Detail

addUserToRoleMapping

public static void addUserToRoleMapping(String contextId,
                                        String principalName,
                                        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(String principalName,
                                              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 String[] getMappingForPrincipal(String contextId,
                                              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 String[] getGlobalMappingForPrincipal(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(String contextId)
Remove a mapping for the given context Id

Parameters:
contextId - Id of the application


Copyright © 2010 OW2 Consortium. All Rights Reserved.