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

java.lang.Object
  extended by org.apache.jetspeed.security.spi.impl.ldap.AbstractLdapDao
      extended by org.apache.jetspeed.security.spi.impl.ldap.LdapPrincipalDaoImpl
All Implemented Interfaces:
LdapPrincipalDao, LdapReadOnlyPrincipalDao
Direct Known Subclasses:
LdapGroupDaoImpl, LdapMemberShipDaoImpl, LdapRoleDaoImpl, LdapUserPrincipalDaoImpl

public abstract class LdapPrincipalDaoImpl
extends AbstractLdapDao
implements LdapPrincipalDao

Author:
Mike Long , David Le Strat
See Also:
LdapPrincipalDao

Field Summary
 
Fields inherited from class org.apache.jetspeed.security.spi.impl.ldap.AbstractLdapDao
ctx
 
Constructor Summary
LdapPrincipalDaoImpl()
           Default constructor.
LdapPrincipalDaoImpl(LdapBindingConfig ldapConfig)
           Initializes the dao.
 
Method Summary
 java.lang.String convertUidToLdapAcceptableName(java.lang.String fullPath)
           Converts the uid to an ldap acceptable name.
 void create(java.lang.String principalUid)
           Makes a new ldap entry for the specified principal.
protected abstract  javax.naming.directory.Attributes defineLdapAttributes(java.lang.String principalUid)
           A template method for defining the attributes for a particular LDAP class.
 void delete(java.lang.String principalUid)
           Deletes a ldap entry for the specified principal.
 java.security.Principal[] find(java.lang.String principalUid, java.lang.String principalType)
           Search the ldap directory for the principal.
protected  javax.naming.directory.Attribute getAttribute(java.lang.String attributeName, javax.naming.directory.Attributes userAttributes)
           
protected abstract  java.lang.String getDnSuffix()
           Builds the dn suffix.
protected  java.lang.String getGroupDN(java.lang.String groupPrincipalUid)
           
protected  java.lang.String getGroupDN(java.lang.String groupPrincipalUid, boolean includeBaseDN)
           
protected  java.lang.String getRoleDN(java.lang.String rolePrincipalUid)
           
protected  java.lang.String getRoleDN(java.lang.String rolePrincipalUid, boolean includeBaseDN)
           
protected  java.lang.String getSearchDomain()
           The domain in wich to perform a search
protected abstract  java.lang.String getUidAttributeForPrincipal()
           Builds the dn suffix.
protected  java.lang.String getUserDN(java.lang.String userPrincipalUid)
           
protected  java.lang.String getUserDN(java.lang.String userPrincipalUid, boolean includeBaseDN)
           
protected abstract  java.security.Principal makePrincipal(java.lang.String principalUid)
           A template method for creating a concrete principal object.
protected  java.lang.String[] parseAttr(java.lang.String attr, java.lang.String replace)
           
 
Methods inherited from class org.apache.jetspeed.security.spi.impl.ldap.AbstractLdapDao
bindToServer, getAttributes, getEntryPrefix, getGroupAttributes, getGroupFilter, getGroupFilterBase, getGroupIdAttribute, getGroupMembershipAttribute, getGroupMembershipForRoleAttribute, getGroupObjectClasses, getGroupObjectRequiredAttributeClasses, getGroupUidAttribute, getKnownAttributes, getObjectClasses, getRoleAttributes, getRoleFilter, getRoleFilterBase, getRoleGroupMembershipForRoleAttribute, getRoleIdAttribute, getRoleMembershipAttribute, getRoleObjectClasses, getRoleObjectRequiredAttributeClasses, getRoleUidAttribute, getRootContext, getSearchScope, getSearchSuffix, 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
 

Constructor Detail

LdapPrincipalDaoImpl

public LdapPrincipalDaoImpl()
                     throws SecurityException

Default constructor.

Throws:
SecurityException - A SecurityException.

LdapPrincipalDaoImpl

public LdapPrincipalDaoImpl(LdapBindingConfig ldapConfig)
                     throws SecurityException

Initializes the dao.

Parameters:
ldapConfig - Holds the ldap binding configuration.
Throws:
SecurityException - A SecurityException.
Method Detail

makePrincipal

protected abstract java.security.Principal makePrincipal(java.lang.String principalUid)

A template method for creating a concrete principal object.

Parameters:
principalUid - The principal uid.
Returns:
A concrete principal object.

defineLdapAttributes

protected abstract javax.naming.directory.Attributes defineLdapAttributes(java.lang.String principalUid)

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

Parameters:
principalUid - The principal uid.
Returns:
The LDAP attributes object for the particular class.

create

public void create(java.lang.String principalUid)
            throws SecurityException
Description copied from interface: LdapPrincipalDao

Makes a new ldap entry for the specified principal.

Specified by:
create in interface LdapPrincipalDao
Parameters:
principalUid - The principal uid.
Throws:
SecurityException - Throws a SecurityException.
See Also:
LdapPrincipalDao.create(java.lang.String)

getDnSuffix

protected abstract java.lang.String getDnSuffix()

Builds the dn suffix.

Returns:
The dn suffix.

getUidAttributeForPrincipal

protected abstract java.lang.String getUidAttributeForPrincipal()

Builds the dn suffix.

Returns:
The dn suffix.

delete

public void delete(java.lang.String principalUid)
            throws SecurityException
Description copied from interface: LdapPrincipalDao

Deletes a ldap entry for the specified principal.

Specified by:
delete in interface LdapPrincipalDao
Parameters:
principalUid - The principal uid.
Throws:
SecurityException - Throws a SecurityException.
See Also:
LdapPrincipalDao.delete(java.lang.String)

convertUidToLdapAcceptableName

public java.lang.String convertUidToLdapAcceptableName(java.lang.String fullPath)
Description copied from interface: LdapPrincipalDao

Converts the uid to an ldap acceptable name.

Specified by:
convertUidToLdapAcceptableName in interface LdapPrincipalDao
Parameters:
fullPath - The uid.
Returns:
The converted name.
See Also:
LdapPrincipalDao.convertUidToLdapAcceptableName(java.lang.String)

find

public java.security.Principal[] find(java.lang.String principalUid,
                                      java.lang.String principalType)
                               throws SecurityException
Description copied from interface: LdapPrincipalDao

Search the ldap directory for the principal.

Specified by:
find in interface LdapPrincipalDao
Parameters:
principalUid - The uid value of the principal.
principalType - The type of principal.
Returns:
All the objects of this LDAP class type.
Throws:
SecurityException
See Also:
LdapPrincipalDao.find(java.lang.String, java.lang.String)

getAttribute

protected javax.naming.directory.Attribute getAttribute(java.lang.String attributeName,
                                                        javax.naming.directory.Attributes userAttributes)
                                                 throws javax.naming.NamingException
Parameters:
attributeName - The attribute name.
userAttributes - The user Attributes.
Returns:
The Attribute.
Throws:
javax.naming.NamingException - Throws a NamingException.

getSearchDomain

protected java.lang.String getSearchDomain()
Description copied from class: AbstractLdapDao

The domain in wich to perform a search

TODO : this should be in spring config

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

parseAttr

protected java.lang.String[] parseAttr(java.lang.String attr,
                                       java.lang.String replace)

getGroupDN

protected java.lang.String getGroupDN(java.lang.String groupPrincipalUid)

getGroupDN

protected java.lang.String getGroupDN(java.lang.String groupPrincipalUid,
                                      boolean includeBaseDN)

getRoleDN

protected java.lang.String getRoleDN(java.lang.String rolePrincipalUid)

getRoleDN

protected java.lang.String getRoleDN(java.lang.String rolePrincipalUid,
                                     boolean includeBaseDN)

getUserDN

protected java.lang.String getUserDN(java.lang.String userPrincipalUid)

getUserDN

protected java.lang.String getUserDN(java.lang.String userPrincipalUid,
                                     boolean includeBaseDN)


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