Class LDAPLookupService

java.lang.Object
org.imixs.workflow.ldap.LDAPLookupService

public class LDAPLookupService extends Object
This EJB provides a ldap lookup service for user informations The bean reads its configuration from the configuration property file located in the glassfish domains config folder (GLASSFISH_DOMAIN/config/imixs-office-ldap.properties). IMPORTANT! The LDAPLookupService can not use the EJB PropertyService because of the PropertyInterceptor Class which will lead into a endless loop between LDAPGroupInterceptor and PropertyInterceptor !!! For that reason the proertyService is used manually here!!
Version:
1.0
Author:
rsoika
  • Field Details

  • Constructor Details

    • LDAPLookupService

      public LDAPLookupService()
  • Method Details

    • getDnSearchFilter

      public String getDnSearchFilter()
    • setDnSearchFilter

      public void setDnSearchFilter(String dnSearchFilter)
    • getSearchFilterPhrase

      public String getSearchFilterPhrase()
    • setSearchFilterPhrase

      public void setSearchFilterPhrase(String searchFilterPhrase)
    • getGroupSearchFilter

      public String getGroupSearchFilter()
    • setGroupSearchFilter

      public void setGroupSearchFilter(String groupSearchFilter)
    • getSearchContext

      public String getSearchContext()
    • setSearchContext

      public void setSearchContext(String searchContext)
    • isEnabled

      public boolean isEnabled()
    • findUser

      public org.imixs.workflow.ItemCollection findUser(String aUID)
      Returns the ldap attributes for a given user. If no user was found in LDAP the method returns null. The method uses an internal cache.
      Parameters:
      aUID - - user id
      Returns:
      ItemCollection containing the user attributes or null if no attributes where found.
    • findUser

      public org.imixs.workflow.ItemCollection findUser(String aUID, boolean refresh)
      Returns the ldap attributes for a given user. If no user was found in LDAP the method returns null.

      If the boolean 'refresh' is true the method lookup the user in any case with a search query and updates the cache.

      Parameters:
      aUID - - user id
      refresh - - if true, cache will be refreshed.
      Returns:
      ItemCollection containing the user attributes or null if no attributes where found.
    • cacheUser

      public void cacheUser(String aUID, org.imixs.workflow.ItemCollection user)
      This method is used to put a user object into the cache. The method can be called form a external service interface.
      Parameters:
      aUID - - userid
      user - - user profile
    • searchUserList

      public List<org.imixs.workflow.ItemCollection> searchUserList(String searchPhrase)
      Returns a list of user entries form the ldap based on a search phrase
      Parameters:
      searchPhrase - - search Phrase
      Returns:
      ItemCollection containing the user attributes or null if no attributes where found.
    • findGroups

      public String[] findGroups(String aUID)
      Returns a string array containing all group names for a given UID. If no groups exist or the uid was not found the method returns an empty string array!.
      Parameters:
      aUID - - user unique id
      Returns:
      string array of group names
    • lookupLdapAttributes

      public org.imixs.workflow.ItemCollection lookupLdapAttributes(String aUID)
      Returns all attributes for a given user in an ItemCollection. If ldap service is disabled or the user was not found then the method returns null.

      The method makes a direct ldap lookup. No cache is used.

      It is recommended to use the method findUser instead of the method lookupLdapAttributes to use the internal caching mechanism.

      Parameters:
      aUID - - user id
      Returns:
      ItemCollection - containing the user attributes or null if no entry was found
    • onEvent

      public void onEvent(@Observes org.imixs.marty.profile.ProfileEvent event)
      This method reacts on CDI events of the type ProfileEvent and lookups the profile data in the ldap directory
    • updateProfileLDAPData

      public void updateProfileLDAPData(String userID, org.imixs.workflow.ItemCollection profile)
      This method updates a profile with ldap data.