org.apache.jetspeed.security.spi.impl
Class LdapSecurityMappingHandler

java.lang.Object
  extended by org.apache.jetspeed.security.spi.impl.LdapSecurityMappingHandler
All Implemented Interfaces:
org.apache.jetspeed.security.spi.SecurityMappingHandler

public class LdapSecurityMappingHandler
extends Object
implements org.apache.jetspeed.security.spi.SecurityMappingHandler

Author:
Mike Long
David Le Strat
See Also:
SecurityMappingHandler

Field Summary
private  LdapPrincipalDao groupDao
           
private  org.apache.jetspeed.security.HierarchyResolver groupHierarchyResolver
          The group hierarchy resolver.
private static org.apache.commons.logging.Log LOG
          The logger.
private  LdapPrincipalDao roleDao
           
private  org.apache.jetspeed.security.HierarchyResolver roleHierarchyResolver
          The role hierarchy resolver.
private  LdapUserPrincipalDao userDao
           
 
Constructor Summary
LdapSecurityMappingHandler()
           
LdapSecurityMappingHandler(LdapUserPrincipalDao userDao, LdapPrincipalDao groupDao, LdapPrincipalDao roleDao)
           
 
Method Summary
private  void addGroupToUser(String username, String groupFullPathName)
           
private  void addRoleToGroup(String groupFullPathName, String roleFullPathName)
           
private  void addRoleToUser(String username, String roleFullPathName)
           
private  void createResolvedGroupPrincipalSet(String username, Set groupPrincipals, String[] groups, int i)
           
private  void createResolvedRolePrincipalSet(String username, Set rolePrincipals, String[] roles, int i)
           
private  org.apache.jetspeed.security.GroupPrincipal getGroup(String uid)
           
 org.apache.jetspeed.security.HierarchyResolver getGroupHierarchyResolver()
           
 Set getGroupPrincipals(String userPrincipalUid)
          This method returns the set of group principals associated with a user.
 Set getGroupPrincipalsInRole(String roleFullPathName)
           
private  org.apache.jetspeed.security.RolePrincipal getRole(String uid)
           
 org.apache.jetspeed.security.HierarchyResolver getRoleHierarchyResolver()
           
 Set getRolePrincipals(String username)
           
 Set getRolePrincipalsInGroup(String groupFullPathName)
           
private  org.apache.jetspeed.security.UserPrincipal getUser(String uid)
           
private  void getUserPrincipalsInGroup(Set userPrincipals, String[] fullPaths)
           Gets the user principals in groups.
 Set getUserPrincipalsInGroup(String groupFullPathName)
           This method is the analog of the getGroupPrincipals except it returns the set of user principals in a group.
private  void getUserPrincipalsInRole(Set userPrincipals, String[] fullPaths)
           Gets the user principals in groups.
 Set getUserPrincipalsInRole(String roleFullPathName)
           
private  void removeRoleFromGroup(String groupFullPathName, String roleFullPathName)
           
 void removeRolePrincipalInGroup(String groupFullPathName, String roleFullPathName)
           
private  void removeUserFromGroup(String username, String groupFullPathName)
           
private  void removeUserFromRole(String username, String roleFullPathName)
           
 void removeUserPrincipalInGroup(String username, String groupFullPathName)
           
 void removeUserPrincipalInRole(String username, String roleFullPathName)
           
 void setGroupHierarchyResolver(org.apache.jetspeed.security.HierarchyResolver groupHierarchyResolver)
           
 void setRoleHierarchyResolver(org.apache.jetspeed.security.HierarchyResolver roleHierarchyResolver)
           
 void setRolePrincipalInGroup(String groupFullPathName, String roleFullPathName)
           
 void setUserPrincipalInGroup(String username, String groupFullPathName)
           
 void setUserPrincipalInRole(String username, String roleFullPathName)
           
private  void verifyGroupAndRoleExist(String groupFullPathName, String roleFullPathName)
           
private  void verifyUserAndGroupExist(String username, String groupFullPathName)
           
private  void verifyUserAndRoleExist(String username, String roleFullPathName)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

userDao

private LdapUserPrincipalDao userDao

groupDao

private LdapPrincipalDao groupDao

roleDao

private LdapPrincipalDao roleDao

LOG

private static final org.apache.commons.logging.Log LOG
The logger.


roleHierarchyResolver

private org.apache.jetspeed.security.HierarchyResolver roleHierarchyResolver
The role hierarchy resolver.


groupHierarchyResolver

private org.apache.jetspeed.security.HierarchyResolver groupHierarchyResolver
The group hierarchy resolver.

Constructor Detail

LdapSecurityMappingHandler

public LdapSecurityMappingHandler(LdapUserPrincipalDao userDao,
                                  LdapPrincipalDao groupDao,
                                  LdapPrincipalDao roleDao)
Parameters:
userDao -
groupDao -

LdapSecurityMappingHandler

public LdapSecurityMappingHandler()
                           throws org.apache.jetspeed.security.SecurityException,
                                  NamingException
Throws:
NamingException - A NamingException.
org.apache.jetspeed.security.SecurityException - A SecurityException.
Method Detail

getRoleHierarchyResolver

public org.apache.jetspeed.security.HierarchyResolver getRoleHierarchyResolver()
Specified by:
getRoleHierarchyResolver in interface org.apache.jetspeed.security.spi.SecurityMappingHandler
See Also:
SecurityMappingHandler.getRoleHierarchyResolver()

setRoleHierarchyResolver

public void setRoleHierarchyResolver(org.apache.jetspeed.security.HierarchyResolver roleHierarchyResolver)
Specified by:
setRoleHierarchyResolver in interface org.apache.jetspeed.security.spi.SecurityMappingHandler
See Also:
SecurityMappingHandler.setRoleHierarchyResolver(org.apache.jetspeed.security.HierarchyResolver)

getGroupHierarchyResolver

public org.apache.jetspeed.security.HierarchyResolver getGroupHierarchyResolver()
Specified by:
getGroupHierarchyResolver in interface org.apache.jetspeed.security.spi.SecurityMappingHandler
Returns:
Returns the groupHierarchyResolver.

setGroupHierarchyResolver

public void setGroupHierarchyResolver(org.apache.jetspeed.security.HierarchyResolver groupHierarchyResolver)
Specified by:
setGroupHierarchyResolver in interface org.apache.jetspeed.security.spi.SecurityMappingHandler
See Also:
SecurityMappingHandler.setGroupHierarchyResolver(org.apache.jetspeed.security.HierarchyResolver)

getRolePrincipals

public Set getRolePrincipals(String username)
Specified by:
getRolePrincipals in interface org.apache.jetspeed.security.spi.SecurityMappingHandler
See Also:
SecurityMappingHandler.getRolePrincipals(java.lang.String)

setUserPrincipalInRole

public void setUserPrincipalInRole(String username,
                                   String roleFullPathName)
                            throws org.apache.jetspeed.security.SecurityException
Specified by:
setUserPrincipalInRole in interface org.apache.jetspeed.security.spi.SecurityMappingHandler
Throws:
org.apache.jetspeed.security.SecurityException
See Also:
SecurityMappingHandler.setUserPrincipalInRole(java.lang.String, java.lang.String)

removeUserPrincipalInRole

public void removeUserPrincipalInRole(String username,
                                      String roleFullPathName)
                               throws org.apache.jetspeed.security.SecurityException
Specified by:
removeUserPrincipalInRole in interface org.apache.jetspeed.security.spi.SecurityMappingHandler
Throws:
org.apache.jetspeed.security.SecurityException
See Also:
SecurityMappingHandler.removeUserPrincipalInRole(java.lang.String, java.lang.String)

getRolePrincipalsInGroup

public Set getRolePrincipalsInGroup(String groupFullPathName)
Specified by:
getRolePrincipalsInGroup in interface org.apache.jetspeed.security.spi.SecurityMappingHandler
See Also:
SecurityMappingHandler.getRolePrincipalsInGroup(java.lang.String)

setRolePrincipalInGroup

public void setRolePrincipalInGroup(String groupFullPathName,
                                    String roleFullPathName)
                             throws org.apache.jetspeed.security.SecurityException
Specified by:
setRolePrincipalInGroup in interface org.apache.jetspeed.security.spi.SecurityMappingHandler
Throws:
org.apache.jetspeed.security.SecurityException
See Also:
SecurityMappingHandler.setRolePrincipalInGroup(java.lang.String, java.lang.String)

removeRolePrincipalInGroup

public void removeRolePrincipalInGroup(String groupFullPathName,
                                       String roleFullPathName)
                                throws org.apache.jetspeed.security.SecurityException
Specified by:
removeRolePrincipalInGroup in interface org.apache.jetspeed.security.spi.SecurityMappingHandler
Throws:
org.apache.jetspeed.security.SecurityException
See Also:
SecurityMappingHandler.removeRolePrincipalInGroup(java.lang.String, java.lang.String)

getGroupPrincipals

public Set getGroupPrincipals(String userPrincipalUid)
This method returns the set of group principals associated with a user.

Specified by:
getGroupPrincipals in interface org.apache.jetspeed.security.spi.SecurityMappingHandler
See Also:
SecurityMappingHandler.getGroupPrincipals(java.lang.String)

getGroupPrincipalsInRole

public Set getGroupPrincipalsInRole(String roleFullPathName)
Specified by:
getGroupPrincipalsInRole in interface org.apache.jetspeed.security.spi.SecurityMappingHandler
See Also:
SecurityMappingHandler.getGroupPrincipalsInRole(java.lang.String)

getUserPrincipalsInRole

public Set getUserPrincipalsInRole(String roleFullPathName)
Specified by:
getUserPrincipalsInRole in interface org.apache.jetspeed.security.spi.SecurityMappingHandler
See Also:
SecurityMappingHandler.getUserPrincipalsInRole(java.lang.String)

getUserPrincipalsInGroup

public Set getUserPrincipalsInGroup(String groupFullPathName)

This method is the analog of the getGroupPrincipals except it returns the set of user principals in a group.

Specified by:
getUserPrincipalsInGroup in interface org.apache.jetspeed.security.spi.SecurityMappingHandler
See Also:
SecurityMappingHandler.getUserPrincipalsInGroup(java.lang.String)

getUserPrincipalsInGroup

private void getUserPrincipalsInGroup(Set userPrincipals,
                                      String[] fullPaths)
                               throws org.apache.jetspeed.security.SecurityException

Gets the user principals in groups.

Parameters:
userPrincipals -
fullPaths -
Throws:
org.apache.jetspeed.security.SecurityException - A SecurityException.

getUserPrincipalsInRole

private void getUserPrincipalsInRole(Set userPrincipals,
                                     String[] fullPaths)
                              throws org.apache.jetspeed.security.SecurityException

Gets the user principals in groups.

Parameters:
userPrincipals -
fullPaths -
Throws:
org.apache.jetspeed.security.SecurityException - A SecurityException.

setUserPrincipalInGroup

public void setUserPrincipalInGroup(String username,
                                    String groupFullPathName)
                             throws org.apache.jetspeed.security.SecurityException
Specified by:
setUserPrincipalInGroup in interface org.apache.jetspeed.security.spi.SecurityMappingHandler
Throws:
org.apache.jetspeed.security.SecurityException
See Also:
SecurityMappingHandler.setUserPrincipalInGroup(java.lang.String, java.lang.String)

removeUserPrincipalInGroup

public void removeUserPrincipalInGroup(String username,
                                       String groupFullPathName)
                                throws org.apache.jetspeed.security.SecurityException
Specified by:
removeUserPrincipalInGroup in interface org.apache.jetspeed.security.spi.SecurityMappingHandler
Throws:
org.apache.jetspeed.security.SecurityException
See Also:
SecurityMappingHandler.removeUserPrincipalInGroup(java.lang.String, java.lang.String)

verifyGroupAndRoleExist

private void verifyGroupAndRoleExist(String groupFullPathName,
                                     String roleFullPathName)
                              throws org.apache.jetspeed.security.SecurityException
Parameters:
username -
groupFullPathName -
Throws:
org.apache.jetspeed.security.SecurityException

verifyUserAndGroupExist

private void verifyUserAndGroupExist(String username,
                                     String groupFullPathName)
                              throws org.apache.jetspeed.security.SecurityException
Parameters:
username -
groupFullPathName -
Throws:
org.apache.jetspeed.security.SecurityException

verifyUserAndRoleExist

private void verifyUserAndRoleExist(String username,
                                    String roleFullPathName)
                             throws org.apache.jetspeed.security.SecurityException
Parameters:
username -
groupFullPathName -
Throws:
org.apache.jetspeed.security.SecurityException

createResolvedGroupPrincipalSet

private void createResolvedGroupPrincipalSet(String username,
                                             Set groupPrincipals,
                                             String[] groups,
                                             int i)
Parameters:
username -
groupPrincipals -
groups -
i -

createResolvedRolePrincipalSet

private void createResolvedRolePrincipalSet(String username,
                                            Set rolePrincipals,
                                            String[] roles,
                                            int i)
Parameters:
username -
groupPrincipals -
groups -
i -

removeUserFromGroup

private void removeUserFromGroup(String username,
                                 String groupFullPathName)
                          throws org.apache.jetspeed.security.SecurityException
Parameters:
username -
groupFullPathName -
Throws:
org.apache.jetspeed.security.SecurityException

removeUserFromRole

private void removeUserFromRole(String username,
                                String roleFullPathName)
                         throws org.apache.jetspeed.security.SecurityException
Parameters:
username -
groupFullPathName -
Throws:
org.apache.jetspeed.security.SecurityException

removeRoleFromGroup

private void removeRoleFromGroup(String groupFullPathName,
                                 String roleFullPathName)
                          throws org.apache.jetspeed.security.SecurityException
Throws:
org.apache.jetspeed.security.SecurityException

getUser

private org.apache.jetspeed.security.UserPrincipal getUser(String uid)
                                                    throws org.apache.jetspeed.security.SecurityException
Parameters:
uid -
Returns:
Throws:
org.apache.jetspeed.security.SecurityException - A SecurityException.

getGroup

private org.apache.jetspeed.security.GroupPrincipal getGroup(String uid)
                                                      throws org.apache.jetspeed.security.SecurityException
Parameters:
uid -
Returns:
Throws:
org.apache.jetspeed.security.SecurityException - A SecurityException.

getRole

private org.apache.jetspeed.security.RolePrincipal getRole(String uid)
                                                    throws org.apache.jetspeed.security.SecurityException
Parameters:
uid -
Returns:
Throws:
org.apache.jetspeed.security.SecurityException - A SecurityException.

addGroupToUser

private void addGroupToUser(String username,
                            String groupFullPathName)
                     throws org.apache.jetspeed.security.SecurityException
Parameters:
username -
groupFullPathName -
Throws:
org.apache.jetspeed.security.SecurityException - A SecurityException.

addRoleToUser

private void addRoleToUser(String username,
                           String roleFullPathName)
                    throws org.apache.jetspeed.security.SecurityException
Parameters:
username -
groupFullPathName -
Throws:
org.apache.jetspeed.security.SecurityException - A SecurityException.

addRoleToGroup

private void addRoleToGroup(String groupFullPathName,
                            String roleFullPathName)
                     throws org.apache.jetspeed.security.SecurityException
Parameters:
username -
groupFullPathName -
Throws:
org.apache.jetspeed.security.SecurityException - A SecurityException.


Copyright © 1999-2007 Apache Software Foundation. All Rights Reserved.