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

java.lang.Object
  extended by org.apache.jetspeed.security.spi.impl.ldap.AbstractLdapDao
Direct Known Subclasses:
InitLdapSchema, LdapPrincipalDaoImpl, LdapUserCredentialDaoImpl

public abstract class AbstractLdapDao
extends java.lang.Object

Abstract ldap dao.

Author:
Mike Long , David Le Strat

Field Summary
protected  javax.naming.ldap.LdapContext ctx
          Reference to remote server context
 
Constructor Summary
AbstractLdapDao()
           Default constructor.
AbstractLdapDao(LdapBindingConfig ldapConfig)
           Initializes the dao.
 
Method Summary
protected  void bindToServer(java.lang.String rootDn, java.lang.String rootPassword)
           Binds to the ldap server.
protected abstract  java.lang.String[] getAttributes()
           
protected abstract  java.lang.String getEntryPrefix()
           A template method that returns the LDAP entry prefix of the concrete DAO.
protected  java.lang.String[] getGroupAttributes()
           
protected  java.lang.String getGroupFilter()
           Returns the default Group suffix dn.
protected  java.lang.String getGroupFilterBase()
           Returns the default Group suffix dn.
protected  java.lang.String getGroupIdAttribute()
           
protected  java.lang.String getGroupMembershipAttribute()
           
protected  java.lang.String getGroupMembershipForRoleAttribute()
           
protected  java.lang.String[] getGroupObjectClasses()
           Returns the default Group suffix dn.
protected  java.lang.String getGroupObjectRequiredAttributeClasses()
           
protected  java.lang.String getGroupUidAttribute()
           
protected  java.lang.String[] getKnownAttributes()
           
protected abstract  java.lang.String[] getObjectClasses()
           
protected  java.lang.String[] getRoleAttributes()
           
protected  java.lang.String getRoleFilter()
           Returns the default Group suffix dn.
protected  java.lang.String getRoleFilterBase()
           Returns the default Group suffix dn.
protected  java.lang.String getRoleGroupMembershipForRoleAttribute()
           
protected  java.lang.String getRoleIdAttribute()
           
protected  java.lang.String getRoleMembershipAttribute()
           
protected  java.lang.String[] getRoleObjectClasses()
           Returns the default Group suffix dn.
protected  java.lang.String getRoleObjectRequiredAttributeClasses()
           
protected  java.lang.String getRoleUidAttribute()
           
protected  java.lang.String getRootContext()
           Returns the root context.
protected abstract  java.lang.String getSearchDomain()
           The domain in wich to perform a search
protected  int getSearchScope()
           
protected abstract  java.lang.String getSearchSuffix()
           A template method that returns the LDAP entry prefix of the concrete DAO.
protected  java.lang.String getSubcontextName(java.lang.String dn)
           Gets the sub context name.
protected  java.lang.String getUidAttribute()
           
protected  java.lang.String[] getUserAttributes()
           
protected  java.lang.String getUserFilter()
           
protected  java.lang.String getUserFilterBase()
           Returns the default Group suffix dn.
protected  java.lang.String getUserGroupMembershipAttribute()
           
protected  java.lang.String getUserIdAttribute()
           
protected  java.lang.String[] getUserObjectClasses()
           
protected  java.lang.String getUserPasswordAttribute()
           
protected  java.lang.String getUserRoleMembershipAttribute()
           
protected  java.lang.String getUserUidAttribute()
           
 java.lang.String lookupByUid(java.lang.String uid)
           Searches the LDAP server for the user with the specified userid (uid attribute).
protected  javax.naming.NamingEnumeration searchByWildcardedUid(java.lang.String filter, javax.naming.directory.SearchControls cons)
           Search uid by wild card.
protected  javax.naming.NamingEnumeration searchGroupByWildcardedUid(java.lang.String filter, javax.naming.directory.SearchControls cons)
           Search uid by wild card.
protected  javax.naming.NamingEnumeration searchRoleByWildcardedUid(java.lang.String filter, javax.naming.directory.SearchControls cons)
           Search uid by wild card.
protected  javax.naming.directory.SearchControls setSearchControls()
           
protected  void validateDn(java.lang.String dn)
           Validate the domain name.
protected  void validatePassword(java.lang.String password)
           Valiate the users password.
protected  void validateUid(java.lang.String uid)
           Validate the uid.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ctx

protected javax.naming.ldap.LdapContext ctx
Reference to remote server context

Constructor Detail

AbstractLdapDao

public AbstractLdapDao()

Default constructor.


AbstractLdapDao

public AbstractLdapDao(LdapBindingConfig ldapConfig)
                throws SecurityException

Initializes the dao.

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

bindToServer

protected void bindToServer(java.lang.String rootDn,
                            java.lang.String rootPassword)
                     throws SecurityException

Binds to the ldap server.

Parameters:
rootDn -
rootPassword -
Throws:
SecurityException

getSubcontextName

protected java.lang.String getSubcontextName(java.lang.String dn)
                                      throws javax.naming.NamingException

Gets the sub context name.

Parameters:
dn - The domain name.
Returns:
The sub context name.
Throws:
javax.naming.NamingException

validateDn

protected void validateDn(java.lang.String dn)
                   throws SecurityException

Validate the domain name.

Parameters:
dn - The domain name.
Throws:
SecurityException

validatePassword

protected void validatePassword(java.lang.String password)
                         throws SecurityException

Valiate the users password.

Parameters:
password - The user.
Throws:
SecurityException

setSearchControls

protected javax.naming.directory.SearchControls setSearchControls()
Returns:
The factors that determine the scope of the search and what gets returned as a result of the search.

lookupByUid

public java.lang.String lookupByUid(java.lang.String uid)
                             throws SecurityException

Searches the LDAP server for the user with the specified userid (uid attribute).

Returns:
the user's DN
Throws:
SecurityException

validateUid

protected void validateUid(java.lang.String uid)
                    throws SecurityException

Validate the uid.

Parameters:
uid - The uid.
Throws:
SecurityException

searchByWildcardedUid

protected javax.naming.NamingEnumeration searchByWildcardedUid(java.lang.String filter,
                                                               javax.naming.directory.SearchControls cons)
                                                        throws javax.naming.NamingException

Search uid by wild card.

Parameters:
filter - The filter.
cons - The SearchControls
Returns:
The NamingEnumeration
Throws:
javax.naming.NamingException - Throws a NamingEnumeration.

searchGroupByWildcardedUid

protected javax.naming.NamingEnumeration searchGroupByWildcardedUid(java.lang.String filter,
                                                                    javax.naming.directory.SearchControls cons)
                                                             throws javax.naming.NamingException

Search uid by wild card.

Parameters:
filter - The filter.
cons - The SearchControls
Returns:
The NamingEnumeration
Throws:
javax.naming.NamingException - Throws a NamingEnumeration.

searchRoleByWildcardedUid

protected javax.naming.NamingEnumeration searchRoleByWildcardedUid(java.lang.String filter,
                                                                   javax.naming.directory.SearchControls cons)
                                                            throws javax.naming.NamingException

Search uid by wild card.

Parameters:
filter - The filter.
cons - The SearchControls
Returns:
The NamingEnumeration
Throws:
javax.naming.NamingException - Throws a NamingEnumeration.

getGroupFilterBase

protected java.lang.String getGroupFilterBase()

Returns the default Group suffix dn.

Returns:
The defaultDnSuffix.

getGroupObjectClasses

protected java.lang.String[] getGroupObjectClasses()

Returns the default Group suffix dn.

Returns:
The defaultDnSuffix.

getRoleFilterBase

protected java.lang.String getRoleFilterBase()

Returns the default Group suffix dn.

Returns:
The defaultDnSuffix.

getRoleObjectClasses

protected java.lang.String[] getRoleObjectClasses()

Returns the default Group suffix dn.

Returns:
The defaultDnSuffix.

getUserFilterBase

protected java.lang.String getUserFilterBase()

Returns the default Group suffix dn.

Returns:
The defaultDnSuffix.

getGroupFilter

protected java.lang.String getGroupFilter()

Returns the default Group suffix dn.

Returns:
The defaultDnSuffix.

getRoleFilter

protected java.lang.String getRoleFilter()

Returns the default Group suffix dn.

Returns:
The defaultDnSuffix.

getRootContext

protected java.lang.String getRootContext()

Returns the root context.

Returns:
The root context.

getEntryPrefix

protected abstract java.lang.String getEntryPrefix()

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

TODO : this should be in spring config

Returns:
a String containing the LDAP entry prefix name.

getSearchSuffix

protected abstract java.lang.String getSearchSuffix()

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

TODO : this should be in spring config

Returns:
a String containing the LDAP entry prefix name.

getSearchDomain

protected abstract java.lang.String getSearchDomain()

The domain in wich to perform a search

TODO : this should be in spring config

Returns:
a String containing the LDAP entry prefix name.

getUserFilter

protected java.lang.String getUserFilter()

getUserObjectClasses

protected java.lang.String[] getUserObjectClasses()

getGroupMembershipAttribute

protected java.lang.String getGroupMembershipAttribute()

getUserGroupMembershipAttribute

protected java.lang.String getUserGroupMembershipAttribute()

getGroupMembershipForRoleAttribute

protected java.lang.String getGroupMembershipForRoleAttribute()

getRoleGroupMembershipForRoleAttribute

protected java.lang.String getRoleGroupMembershipForRoleAttribute()

getRoleMembershipAttribute

protected java.lang.String getRoleMembershipAttribute()

getUserRoleMembershipAttribute

protected java.lang.String getUserRoleMembershipAttribute()

getRoleIdAttribute

protected java.lang.String getRoleIdAttribute()

getGroupIdAttribute

protected java.lang.String getGroupIdAttribute()

getUserIdAttribute

protected java.lang.String getUserIdAttribute()

getUidAttribute

protected java.lang.String getUidAttribute()

getSearchScope

protected int getSearchScope()

getRoleUidAttribute

protected java.lang.String getRoleUidAttribute()

getGroupUidAttribute

protected java.lang.String getGroupUidAttribute()

getUserUidAttribute

protected java.lang.String getUserUidAttribute()

getGroupObjectRequiredAttributeClasses

protected java.lang.String getGroupObjectRequiredAttributeClasses()

getRoleObjectRequiredAttributeClasses

protected java.lang.String getRoleObjectRequiredAttributeClasses()

getUserAttributes

protected java.lang.String[] getUserAttributes()

getGroupAttributes

protected java.lang.String[] getGroupAttributes()

getRoleAttributes

protected java.lang.String[] getRoleAttributes()

getUserPasswordAttribute

protected java.lang.String getUserPasswordAttribute()

getKnownAttributes

protected java.lang.String[] getKnownAttributes()

getObjectClasses

protected abstract java.lang.String[] getObjectClasses()

getAttributes

protected abstract java.lang.String[] getAttributes()


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