org.apache.jetspeed.security.spi.impl.ldap
Class LdapMemberShipDaoImpl

java.lang.Object
  extended by org.apache.jetspeed.security.spi.impl.ldap.AbstractLdapDao
      extended by org.apache.jetspeed.security.spi.impl.ldap.LdapPrincipalDaoImpl
          extended by org.apache.jetspeed.security.spi.impl.ldap.LdapMemberShipDaoImpl
All Implemented Interfaces:
LdapMembershipDao, LdapPrincipalDao, LdapReadOnlyPrincipalDao

public class LdapMemberShipDaoImpl
extends LdapPrincipalDaoImpl
implements LdapMembershipDao


Field Summary
private static org.apache.commons.logging.Log logger
          The logger.
 
Fields inherited from class org.apache.jetspeed.security.spi.impl.ldap.AbstractLdapDao
ctx
 
Constructor Summary
LdapMemberShipDaoImpl()
           
LdapMemberShipDaoImpl(LdapBindingConfig config)
           
 
Method Summary
protected  Attributes defineLdapAttributes(String principalUid)
           A template method for defining the attributes for a particular LDAP class.
private  String extractLdapAttr(String dn, String ldapAttrName)
           
protected  String[] getAttributes()
           
protected  List getAttributes(Attribute attr)
           
protected  List getAttributes(Attribute attr, String filter)
           
protected  String getDnSuffix()
           Builds the dn suffix.
protected  String getEntryPrefix()
           A template method that returns the LDAP entry prefix of the concrete DAO.
private  Attributes getFirstUser(NamingEnumeration results)
           
protected  String[] getObjectClasses()
           
protected  String getSearchSuffix()
           A template method that returns the LDAP entry prefix of the concrete DAO.
protected  String getUidAttributeForPrincipal()
           Builds the dn suffix.
protected  Principal makePrincipal(String principalUid)
           Creates a GroupPrincipal object.
 String[] searchGroupMemberShipByGroup(String userPrincipalUid, SearchControls cons)
           
 String[] searchGroupMemberShipByUser(String userPrincipalUid, SearchControls cons)
           
 String[] searchRoleMemberShipByRole(String userPrincipalUid, SearchControls cons)
           
 String[] searchRoleMemberShipByUser(String userPrincipalUid, SearchControls cons)
           
 String[] searchRolesFromGroupByGroup(String groupPrincipalUid, SearchControls cons)
           
 String[] searchRolesFromGroupByRole(String groupPrincipalUid, SearchControls cons)
           
 String[] searchUsersFromGroupByGroup(String groupPrincipalUid, SearchControls cons)
           Search user by group using the GroupMembershipAttribute.
 String[] searchUsersFromGroupByUser(String groupPrincipalUid, SearchControls cons)
           Search user by group using the UserGroupMembershipAttribute.
 String[] searchUsersFromRoleByRole(String rolePrincipalUid, SearchControls cons)
           Search user by role using the RoleMembershipAttribute.
 String[] searchUsersFromRoleByUser(String rolePrincipalUid, SearchControls cons)
           Search user by role using the UserRoleMembershipAttribute.
 
Methods inherited from class org.apache.jetspeed.security.spi.impl.ldap.LdapPrincipalDaoImpl
convertUidToLdapAcceptableName, create, delete, find, getAttribute, getGroupDN, getGroupDN, getRoleDN, getRoleDN, getSearchDomain, getUserDN, getUserDN, parseAttr
 
Methods inherited from class org.apache.jetspeed.security.spi.impl.ldap.AbstractLdapDao
bindToServer, getGroupAttributes, getGroupFilter, getGroupFilterBase, getGroupIdAttribute, getGroupMembershipAttribute, getGroupMembershipForRoleAttribute, getGroupObjectClasses, getGroupObjectRequiredAttributeClasses, getGroupUidAttribute, getKnownAttributes, getRoleAttributes, getRoleFilter, getRoleFilterBase, getRoleGroupMembershipForRoleAttribute, getRoleIdAttribute, getRoleMembershipAttribute, getRoleObjectClasses, getRoleObjectRequiredAttributeClasses, getRoleUidAttribute, getRootContext, getSearchScope, getSubcontextName, getUidAttribute, getUserAttributes, getUserFilter, getUserFilterBase, getUserGroupMembershipAttribute, getUserIdAttribute, getUserObjectClasses, getUserPasswordAttribute, getUserRoleMembershipAttribute, getUserUidAttribute, lookupByUid, searchByWildcardedUid, searchGroupByWildcardedUid, searchRoleByWildcardedUid, setSearchControls, validateDn, validatePassword, validateUid
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.jetspeed.security.spi.impl.ldap.LdapReadOnlyPrincipalDao
lookupByUid
 

Field Detail

logger

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

Constructor Detail

LdapMemberShipDaoImpl

public LdapMemberShipDaoImpl()
                      throws org.apache.jetspeed.security.SecurityException
Throws:
org.apache.jetspeed.security.SecurityException

LdapMemberShipDaoImpl

public LdapMemberShipDaoImpl(LdapBindingConfig config)
                      throws org.apache.jetspeed.security.SecurityException
Throws:
org.apache.jetspeed.security.SecurityException
Method Detail

searchGroupMemberShipByGroup

public String[] searchGroupMemberShipByGroup(String userPrincipalUid,
                                             SearchControls cons)
                                      throws NamingException
Specified by:
searchGroupMemberShipByGroup in interface LdapMembershipDao
Throws:
NamingException

searchGroupMemberShipByUser

public String[] searchGroupMemberShipByUser(String userPrincipalUid,
                                            SearchControls cons)
                                     throws NamingException
Specified by:
searchGroupMemberShipByUser in interface LdapMembershipDao
Throws:
NamingException

searchRoleMemberShipByRole

public String[] searchRoleMemberShipByRole(String userPrincipalUid,
                                           SearchControls cons)
                                    throws NamingException
Specified by:
searchRoleMemberShipByRole in interface LdapMembershipDao
Throws:
NamingException

searchRoleMemberShipByUser

public String[] searchRoleMemberShipByUser(String userPrincipalUid,
                                           SearchControls cons)
                                    throws NamingException
Specified by:
searchRoleMemberShipByUser in interface LdapMembershipDao
Throws:
NamingException

searchUsersFromGroupByGroup

public String[] searchUsersFromGroupByGroup(String groupPrincipalUid,
                                            SearchControls cons)
                                     throws NamingException
Description copied from interface: LdapMembershipDao

Search user by group using the GroupMembershipAttribute.

Specified by:
searchUsersFromGroupByGroup in interface LdapMembershipDao
Returns:
Throws:
NamingException - A NamingException.

searchUsersFromGroupByUser

public String[] searchUsersFromGroupByUser(String groupPrincipalUid,
                                           SearchControls cons)
                                    throws NamingException
Description copied from interface: LdapMembershipDao

Search user by group using the UserGroupMembershipAttribute.

Specified by:
searchUsersFromGroupByUser in interface LdapMembershipDao
Returns:
Throws:
NamingException - A NamingException.

searchRolesFromGroupByGroup

public String[] searchRolesFromGroupByGroup(String groupPrincipalUid,
                                            SearchControls cons)
                                     throws NamingException
Specified by:
searchRolesFromGroupByGroup in interface LdapMembershipDao
Throws:
NamingException

searchRolesFromGroupByRole

public String[] searchRolesFromGroupByRole(String groupPrincipalUid,
                                           SearchControls cons)
                                    throws NamingException
Specified by:
searchRolesFromGroupByRole in interface LdapMembershipDao
Throws:
NamingException

searchUsersFromRoleByRole

public String[] searchUsersFromRoleByRole(String rolePrincipalUid,
                                          SearchControls cons)
                                   throws NamingException
Description copied from interface: LdapMembershipDao

Search user by role using the RoleMembershipAttribute.

Specified by:
searchUsersFromRoleByRole in interface LdapMembershipDao
Returns:
Throws:
NamingException - A NamingException.

searchUsersFromRoleByUser

public String[] searchUsersFromRoleByUser(String rolePrincipalUid,
                                          SearchControls cons)
                                   throws NamingException
Description copied from interface: LdapMembershipDao

Search user by role using the UserRoleMembershipAttribute.

Specified by:
searchUsersFromRoleByUser in interface LdapMembershipDao
Returns:
Throws:
NamingException - A NamingException.

getAttributes

protected List getAttributes(Attribute attr)
                      throws NamingException
Parameters:
attr -
Returns:
Throws:
NamingException

getAttributes

protected List getAttributes(Attribute attr,
                             String filter)
                      throws NamingException
Parameters:
attr -
Returns:
Throws:
NamingException

getFirstUser

private Attributes getFirstUser(NamingEnumeration results)
                         throws NamingException
Parameters:
results -
Returns:
Throws:
NamingException

defineLdapAttributes

protected Attributes defineLdapAttributes(String principalUid)

A template method for defining the attributes for a particular LDAP class.

Specified by:
defineLdapAttributes in class LdapPrincipalDaoImpl
Parameters:
principalUid - The principal uid.
Returns:
the LDAP attributes object for the particular class.

getDnSuffix

protected String getDnSuffix()
Description copied from class: LdapPrincipalDaoImpl

Builds the dn suffix.

Specified by:
getDnSuffix in class LdapPrincipalDaoImpl
Returns:
The dn suffix.
See Also:
LdapPrincipalDaoImpl.getDnSuffix()

makePrincipal

protected Principal makePrincipal(String principalUid)

Creates a GroupPrincipal object.

Specified by:
makePrincipal in class LdapPrincipalDaoImpl
Parameters:
principalUid - The principal uid.
Returns:
A group principal object.

extractLdapAttr

private String extractLdapAttr(String dn,
                               String ldapAttrName)

getObjectClasses

protected String[] getObjectClasses()
Specified by:
getObjectClasses in class AbstractLdapDao

getUidAttributeForPrincipal

protected String getUidAttributeForPrincipal()
Description copied from class: LdapPrincipalDaoImpl

Builds the dn suffix.

Specified by:
getUidAttributeForPrincipal in class LdapPrincipalDaoImpl
Returns:
The dn suffix.

getAttributes

protected String[] getAttributes()
Specified by:
getAttributes in class AbstractLdapDao

getEntryPrefix

protected String getEntryPrefix()
Description copied from class: AbstractLdapDao

A template method that returns the LDAP entry prefix of the concrete DAO.

TODO : this should be in spring config

Specified by:
getEntryPrefix in class AbstractLdapDao
Returns:
a String containing the LDAP entry prefix name.

getSearchSuffix

protected String getSearchSuffix()
Description copied from class: AbstractLdapDao

A template method that returns the LDAP entry prefix of the concrete DAO.

TODO : this should be in spring config

Specified by:
getSearchSuffix in class AbstractLdapDao
Returns:
a String containing the LDAP entry prefix name.


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