Package de.xima.fc.ldap
Class LDAPDataUtil
- java.lang.Object
 - 
- de.xima.fc.ldap.LDAPDataUtil
 
 
- 
public class LDAPDataUtil extends Object
 
- 
- 
Constructor Summary
Constructors Constructor Description LDAPDataUtil() 
- 
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static List<String>getAttributeList(com.unboundid.ldap.sdk.LDAPConnection connection, String baseDN, com.unboundid.ldap.sdk.SearchScope scope, Integer pageSize, com.unboundid.ldap.sdk.Filter filter, String attribute)Returns a list of values of the passed attribute.static List<String>getDNResultList(com.unboundid.ldap.sdk.SearchResult res)static byte[]getObjectID(com.unboundid.ldap.sdk.SearchResultEntry entry)static byte[]getObjectID(Map<String,Object> attributes)static StringgetObjectIDAsString(com.unboundid.ldap.sdk.SearchResultEntry entry)static com.unboundid.ldap.sdk.AttributegetObjectIDAttribute(com.unboundid.ldap.sdk.SearchResultEntry entry)static byte[]getObjectIDAttribute(Map<String,Object> attributes)static intgetTotalCount(com.unboundid.ldap.sdk.LDAPConnection con, String baseDN, com.unboundid.ldap.sdk.SearchScope scope, Integer pageSize, com.unboundid.ldap.sdk.Filter filter, String... attributes)static intgetTotalCount(com.unboundid.ldap.sdk.LDAPConnection con, String baseDN, com.unboundid.ldap.sdk.SearchScope scope, Integer pageSize, String filter, String... attributes)static com.unboundid.ldap.sdk.AttributegetUserLoginAttribute(com.unboundid.ldap.sdk.SearchResultEntry entry)static List<com.unboundid.ldap.sdk.SearchResult>searchEntries(com.unboundid.ldap.sdk.LDAPConnection con, String baseDN, com.unboundid.ldap.sdk.SearchScope scope, Integer pageSize, com.unboundid.ldap.sdk.Filter filter, String... attributes)Performs a query to an active directory and returns all results.static List<com.unboundid.ldap.sdk.SearchResult>searchEntries(com.unboundid.ldap.sdk.LDAPConnection con, String baseDN, com.unboundid.ldap.sdk.SearchScope scope, Integer pageSize, String filter, String... attributes)Performs a query to an active directory and returns all results.static com.alibaba.fastjson.JSONArraysearchJSON(com.unboundid.ldap.sdk.LDAPConnection con, String baseDN, com.unboundid.ldap.sdk.SearchScope scope, Integer pageSize, com.unboundid.ldap.sdk.Filter filter, String... attributes)static com.alibaba.fastjson.JSONArraysearchJSON(com.unboundid.ldap.sdk.LDAPConnection con, String baseDN, com.unboundid.ldap.sdk.SearchScope scope, Integer pageSize, String filter, String... attributes)static List<LDAPBenutzer>searchLDAPBenutzer(com.unboundid.ldap.sdk.LDAPConnection con, String baseDN, com.unboundid.ldap.sdk.SearchScope scope, Integer pageSize, com.unboundid.ldap.sdk.Filter filter, String... attributes)static List<LDAPBenutzer>searchLDAPBenutzer(com.unboundid.ldap.sdk.LDAPConnection con, String baseDN, com.unboundid.ldap.sdk.SearchScope scope, Integer pageSize, String filter, String... attributes)static List<String>searchLDAPGroups(LDAPGruppe gruppe, MandantLdapData data)static com.alibaba.fastjson.JSONObjectsearchSingelJSON(com.unboundid.ldap.sdk.LDAPConnection con, String baseDN, com.unboundid.ldap.sdk.SearchScope scope, com.unboundid.ldap.sdk.Filter filter, String... attributes)Performs a query to an active directory and returns the first result, converted to a JSON object.static com.alibaba.fastjson.JSONObjectsearchSingelJSON(com.unboundid.ldap.sdk.LDAPConnection con, String baseDN, com.unboundid.ldap.sdk.SearchScope scope, String filter, String... attributes)Performs a query to an active directory and returns the first result, converted to a JSON object.static com.unboundid.ldap.sdk.SearchResultEntrysearchSingleEntry(com.unboundid.ldap.sdk.LDAPConnection con, String baseDN, com.unboundid.ldap.sdk.SearchScope scope, com.unboundid.ldap.sdk.Filter filter, String... attributes)Performs a query to an active directory and returns the first result.static com.unboundid.ldap.sdk.SearchResultEntrysearchSingleEntry(com.unboundid.ldap.sdk.LDAPConnection con, String baseDN, com.unboundid.ldap.sdk.SearchScope scope, String filter, String... attributes)Performs a query to an active directory and returns the first result. 
 - 
 
- 
- 
Method Detail
- 
searchJSON
public static com.alibaba.fastjson.JSONArray searchJSON(com.unboundid.ldap.sdk.LDAPConnection con, String baseDN, com.unboundid.ldap.sdk.SearchScope scope, Integer pageSize, String filter, String... attributes) throws com.unboundid.ldap.sdk.LDAPException, com.alibaba.fastjson.JSONException- Throws:
 com.unboundid.ldap.sdk.LDAPExceptioncom.alibaba.fastjson.JSONException
 
- 
searchJSON
public static com.alibaba.fastjson.JSONArray searchJSON(com.unboundid.ldap.sdk.LDAPConnection con, String baseDN, com.unboundid.ldap.sdk.SearchScope scope, Integer pageSize, com.unboundid.ldap.sdk.Filter filter, String... attributes) throws com.unboundid.ldap.sdk.LDAPException, com.alibaba.fastjson.JSONException- Throws:
 com.unboundid.ldap.sdk.LDAPExceptioncom.alibaba.fastjson.JSONException
 
- 
searchEntries
public static List<com.unboundid.ldap.sdk.SearchResult> searchEntries(com.unboundid.ldap.sdk.LDAPConnection con, String baseDN, com.unboundid.ldap.sdk.SearchScope scope, Integer pageSize, String filter, String... attributes) throws com.unboundid.ldap.sdk.LDAPException
Performs a query to an active directory and returns all results.- Parameters:
 con- Connection to the active directory.baseDN- Base DN where to start the search.scope- The scope for the search.filter- A filter for limiting the search results.pageSize- If null or less than or equal to0, no paging is applied and the returned list will contain exactly one entry. Otherwise, results are retrieved in batches of the given page size, and the returned list will contain {ceil(totalNumberOfResults/pageSize} entries.attributes- An optional list of attributes that should be returned. If none are given, all attributes are returned.- Returns:
 - The first result that was returned, or 
nullwhen no result could be found. - Throws:
 com.unboundid.ldap.sdk.LDAPException- When the query could not be made, such as when the filter is invalid etc.com.alibaba.fastjson.JSONException- When the result could not be converted to a JSON object.
 
- 
searchEntries
public static List<com.unboundid.ldap.sdk.SearchResult> searchEntries(com.unboundid.ldap.sdk.LDAPConnection con, String baseDN, com.unboundid.ldap.sdk.SearchScope scope, Integer pageSize, com.unboundid.ldap.sdk.Filter filter, String... attributes) throws com.unboundid.ldap.sdk.LDAPException
Performs a query to an active directory and returns all results.- Parameters:
 con- Connection to the active directory.baseDN- Base DN where to start the search.scope- The scope for the search.filter- A filter for limiting the search results.pageSize- If null or less than or equal to0, no paging is applied and the returned list will contain exactly one entry. Otherwise, results are retrieved in batches of the given page size, and the returned list will contain {ceil(totalNumberOfResults/pageSize} entries.attributes- An optional list of attributes that should be returned. If none are given, all attributes are returned.- Returns:
 - The first result that was returned, or 
nullwhen no result could be found. - Throws:
 com.unboundid.ldap.sdk.LDAPException- When the query could not be made, such as when the filter is invalid etc.com.alibaba.fastjson.JSONException- When the result could not be converted to a JSON object.
 
- 
searchSingelJSON
public static com.alibaba.fastjson.JSONObject searchSingelJSON(com.unboundid.ldap.sdk.LDAPConnection con, String baseDN, com.unboundid.ldap.sdk.SearchScope scope, String filter, String... attributes) throws com.unboundid.ldap.sdk.LDAPException, com.alibaba.fastjson.JSONExceptionPerforms a query to an active directory and returns the first result, converted to a JSON object.- Parameters:
 con- Connection to the active directory.baseDN- Base DN where to start the search.scope- The scope for the search.filter- A filter for limiting the search results.attributes- An optional list of attributes that should be returned. If none are given, all attributes are returned.- Returns:
 - The first result that was returned, or 
nullwhen no result could be found. - Throws:
 com.unboundid.ldap.sdk.LDAPException- When the query could not be made, such as when the filter is invalid etc.com.alibaba.fastjson.JSONException- When the result could not be converted to a JSON object.
 
- 
searchSingelJSON
public static com.alibaba.fastjson.JSONObject searchSingelJSON(com.unboundid.ldap.sdk.LDAPConnection con, String baseDN, com.unboundid.ldap.sdk.SearchScope scope, com.unboundid.ldap.sdk.Filter filter, String... attributes) throws com.unboundid.ldap.sdk.LDAPException, com.alibaba.fastjson.JSONExceptionPerforms a query to an active directory and returns the first result, converted to a JSON object.- Parameters:
 con- Connection to the active directory.baseDN- Base DN where to start the search.scope- The scope for the search.filter- A filter for limiting the search results.attributes- An optional list of attributes that should be returned. If none are given, all attributes are returned.- Returns:
 - The first result that was returned, or 
nullwhen no result could be found. - Throws:
 com.unboundid.ldap.sdk.LDAPException- When the query could not be made, such as when the filter is invalid etc.com.alibaba.fastjson.JSONException- When the result could not be converted to a JSON object.
 
- 
searchSingleEntry
public static com.unboundid.ldap.sdk.SearchResultEntry searchSingleEntry(com.unboundid.ldap.sdk.LDAPConnection con, String baseDN, com.unboundid.ldap.sdk.SearchScope scope, String filter, String... attributes) throws com.unboundid.ldap.sdk.LDAPExceptionPerforms a query to an active directory and returns the first result.- Parameters:
 con- Connection to the active directory.baseDN- Base DN where to start the search.scope- The scope for the search.filter- A filter for limiting the search results.attributes- An optional list of attributes that should be returned. If none are given, all attributes are returned.- Returns:
 - The first result that was returned, or 
nullwhen no result could be found. - Throws:
 com.unboundid.ldap.sdk.LDAPException- When the query could not be made, such as when the filter is invalid etc.
 
- 
searchSingleEntry
public static com.unboundid.ldap.sdk.SearchResultEntry searchSingleEntry(com.unboundid.ldap.sdk.LDAPConnection con, String baseDN, com.unboundid.ldap.sdk.SearchScope scope, com.unboundid.ldap.sdk.Filter filter, String... attributes) throws com.unboundid.ldap.sdk.LDAPExceptionPerforms a query to an active directory and returns the first result.- Parameters:
 con- Connection to the active directory.baseDN- Base DN where to start the search.scope- The scope for the search.filter- A filter for limiting the search results.attributes- An optional list of attributes that should be returned. If none are given, all attributes are returned.- Returns:
 - The first result that was returned, or 
nullwhen no result could be found. - Throws:
 com.unboundid.ldap.sdk.LDAPException- When the query could not be made, such as when the filter is invalid etc.
 
- 
searchLDAPBenutzer
public static List<LDAPBenutzer> searchLDAPBenutzer(com.unboundid.ldap.sdk.LDAPConnection con, String baseDN, com.unboundid.ldap.sdk.SearchScope scope, Integer pageSize, String filter, String... attributes) throws com.unboundid.ldap.sdk.LDAPException
- Throws:
 com.unboundid.ldap.sdk.LDAPException
 
- 
searchLDAPBenutzer
public static List<LDAPBenutzer> searchLDAPBenutzer(com.unboundid.ldap.sdk.LDAPConnection con, String baseDN, com.unboundid.ldap.sdk.SearchScope scope, Integer pageSize, com.unboundid.ldap.sdk.Filter filter, String... attributes) throws com.unboundid.ldap.sdk.LDAPException
- Throws:
 com.unboundid.ldap.sdk.LDAPException
 
- 
getAttributeList
public static List<String> getAttributeList(com.unboundid.ldap.sdk.LDAPConnection connection, String baseDN, com.unboundid.ldap.sdk.SearchScope scope, Integer pageSize, com.unboundid.ldap.sdk.Filter filter, String attribute) throws com.unboundid.ldap.sdk.LDAPException
Returns a list of values of the passed attribute.- Parameters:
 connection- the currentLDAPConnectionbaseDN- The base DN for the search request. It must not benull.scope- The scope that specifies the range of entries that should be examined for the search.pageSize- Size of a pagefilter- The string representation of the filter to use to identify matching entries. It must not benull.attribute- The LDAP attribute to retrieve- Returns:
 - List of values of the attribute
 - Throws:
 com.unboundid.ldap.sdk.LDAPException- If the provided filter string cannot be parsed as an LDAP filter.
 
- 
searchLDAPGroups
public static List<String> searchLDAPGroups(LDAPGruppe gruppe, MandantLdapData data) throws com.unboundid.ldap.sdk.LDAPException, GeneralSecurityException
- Throws:
 com.unboundid.ldap.sdk.LDAPExceptionGeneralSecurityException
 
- 
getDNResultList
public static List<String> getDNResultList(com.unboundid.ldap.sdk.SearchResult res)
 
- 
getUserLoginAttribute
public static com.unboundid.ldap.sdk.Attribute getUserLoginAttribute(com.unboundid.ldap.sdk.SearchResultEntry entry)
 
- 
getTotalCount
public static int getTotalCount(com.unboundid.ldap.sdk.LDAPConnection con, String baseDN, com.unboundid.ldap.sdk.SearchScope scope, Integer pageSize, String filter, String... attributes) throws com.unboundid.ldap.sdk.LDAPException- Throws:
 com.unboundid.ldap.sdk.LDAPException
 
- 
getTotalCount
public static int getTotalCount(com.unboundid.ldap.sdk.LDAPConnection con, String baseDN, com.unboundid.ldap.sdk.SearchScope scope, Integer pageSize, com.unboundid.ldap.sdk.Filter filter, String... attributes) throws com.unboundid.ldap.sdk.LDAPException- Throws:
 com.unboundid.ldap.sdk.LDAPException
 
- 
getObjectIDAsString
public static String getObjectIDAsString(com.unboundid.ldap.sdk.SearchResultEntry entry)
 
- 
getObjectIDAttribute
public static com.unboundid.ldap.sdk.Attribute getObjectIDAttribute(com.unboundid.ldap.sdk.SearchResultEntry entry)
 
- 
getObjectIDAttribute
public static byte[] getObjectIDAttribute(Map<String,Object> attributes) throws ParseException
- Throws:
 ParseException
 
- 
getObjectID
public static byte[] getObjectID(com.unboundid.ldap.sdk.SearchResultEntry entry)
 
 - 
 
 -