Esri Geoportal Server
1.0

com.esri.gpt.framework.security.identity.ldap
Class LdapQueryFunctions

java.lang.Object
  extended by com.esri.gpt.framework.security.identity.ldap.LdapFunctions
      extended by com.esri.gpt.framework.security.identity.ldap.LdapQueryFunctions

public class LdapQueryFunctions
extends LdapFunctions

Handles functionality related to querying an LDAP identity store.


Constructor Summary
protected LdapQueryFunctions()
          Default constructor.
protected LdapQueryFunctions(LdapConfiguration configuration)
          Construct with a supplied configuration.
 
Method Summary
protected  void appendAttributeValues(Attributes attributes, Map<String,Object> values, boolean stringsOnly)
          Appends attribute values to a map (keyed on attribute id).
protected  void appendSubStringValues(Attribute attribute, StringSet values)
          Appends a collection of sub-string attribute values to a list.
protected  StringSet readAttribute(DirContext dirContext, String objectDN, String attrubuteName)
          Reads the attribute values associated with an attribute name.
protected  Map<String,Object> readAttributes(DirContext dirContext, String objectDN, boolean stringsOnly)
          Reads directory object attributes into a HashMap (keyed on attribute id).
protected  StringSet readGroupMembers(DirContext dirContext, String groupDN)
          Reads group member name strings into a list.
protected  String readUserDisplayName(DirContext dirContext, String userDN)
          Retrieves this display name for a user.
protected  void readUserGroups(DirContext dirContext, User user)
          Reads the groups to which a user belongs.
protected  String readUsername(DirContext dirContext, String userDN)
          Retrieves this username attribute for a user.
protected  void readUserProfile(DirContext dirContext, User user)
          Reads the profile attributes for a user.
protected  StringSet searchDNs(DirContext dirContext, String baseDN, String filter)
          Returns a list of distinguished names resulting from a search.
 
Methods inherited from class com.esri.gpt.framework.security.identity.ldap.LdapFunctions
buildFullDN, closeEnumeration, getConfiguration, setConfiguration
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LdapQueryFunctions

protected LdapQueryFunctions()
Default constructor.


LdapQueryFunctions

protected LdapQueryFunctions(LdapConfiguration configuration)
Construct with a supplied configuration.

Parameters:
configuration - the configuration
Method Detail

appendAttributeValues

protected void appendAttributeValues(Attributes attributes,
                                     Map<String,Object> values,
                                     boolean stringsOnly)
                              throws NamingException
Appends attribute values to a map (keyed on attribute id).

Parameters:
attributes - the attributes to append (from)
values - the map of values to populate (to)
stringsOnly - if true, only attributes values of type String will be appended
Throws:
NamingException - if an exception occurs

appendSubStringValues

protected void appendSubStringValues(Attribute attribute,
                                     StringSet values)
                              throws NamingException
Appends a collection of sub-string attribute values to a list.
The sub-attributes are determined by attribute.getAll().
Only sub-attributes of type String will be appended.

Parameters:
attribute - the attribute containing values to append (from)
values - the list of values to populate (to)
Throws:
NamingException - if an exception occurs

readAttribute

protected StringSet readAttribute(DirContext dirContext,
                                  String objectDN,
                                  String attrubuteName)
                           throws NamingException
Reads the attribute values associated with an attribute name.

Parameters:
dirContext - the directory context
attrubuteName - attribute name.
objectDN - the distinguished name of the object
Returns:
the list attribute values (strings only are returned)
Throws:
NamingException - if an exception occurs

readAttributes

protected Map<String,Object> readAttributes(DirContext dirContext,
                                            String objectDN,
                                            boolean stringsOnly)
                                     throws NamingException
Reads directory object attributes into a HashMap (keyed on attribute id).

Parameters:
objectDN - the distinguished name of the object
stringsOnly - if true, consider strings only
Returns:
the attribute HashMap
Throws:
NamingException - if an exception occurs

readGroupMembers

protected StringSet readGroupMembers(DirContext dirContext,
                                     String groupDN)
                              throws NamingException
Reads group member name strings into a list.

Parameters:
dirContext - the directory context
groupDN - the distinguished name of the group
Returns:
the list of group member strings
Throws:
NamingException - if an exception occurs

readUserDisplayName

protected String readUserDisplayName(DirContext dirContext,
                                     String userDN)
                              throws NamingException
Retrieves this display name for a user.

Parameters:
dirContext - the directory context
userDN - the distinguished name for the user
Returns:
the user display name
Throws:
NamingException

readUserGroups

protected void readUserGroups(DirContext dirContext,
                              User user)
                       throws NamingException
Reads the groups to which a user belongs.

Parameters:
dirContext - the directory context
user - the subject user
Throws:
NamingException - if an LDAP naming exception occurs

readUsername

protected String readUsername(DirContext dirContext,
                              String userDN)
                       throws NamingException
Retrieves this username attribute for a user.

Parameters:
dirContext - the directory context
userDN - the distinguished name for the user
Returns:
the username
Throws:
NamingException - if the username attribute does not exist

readUserProfile

protected void readUserProfile(DirContext dirContext,
                               User user)
                        throws NamingException
Reads the profile attributes for a user.

Parameters:
dirContext - the directory context
user - the subject user
Throws:
NamingException - if an LDAP naming exception occurs

searchDNs

protected StringSet searchDNs(DirContext dirContext,
                              String baseDN,
                              String filter)
                       throws NamingException
Returns a list of distinguished names resulting from a search.
The search is executed with SearchControls.SUBTREE_SCOPE.

Parameters:
dirContext - the directory context
baseDN - the baseBN for the search
filter - the filter for the search
Returns:
a collection of distinguished names
Throws:
NamingException - if an exception occurs

Esri Geoportal Server
1.0

Copyright 2011 Environmental Systems Research Institute. All rights reserved. Use is subject to license terms.