Class LDAPDataUtil
java.lang.Object
de.xima.fc.ldap.LDAPDataUtil
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetAttributeList(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.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) Returns the total count of entries that match the given filter.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) Deprecated.static intgetTotalCount(com.unboundid.ldap.sdk.LDAPConnection con, String baseDN, com.unboundid.ldap.sdk.SearchScope scope, Integer pageSize, String filter, String... attributes) Deprecated.static com.unboundid.ldap.sdk.AttributegetUserIdAttribute(com.unboundid.ldap.sdk.SearchResultEntry entry, String attrName) 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 List<com.unboundid.ldap.sdk.SearchResultEntry> searchEntriesFlat(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 flattened results.static List<com.unboundid.ldap.sdk.SearchResultEntry> searchEntriesFlat(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 flattened 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) Deprecated.User management has been reworked.static List<LDAPBenutzer> searchLDAPBenutzer(com.unboundid.ldap.sdk.LDAPConnection con, String baseDN, com.unboundid.ldap.sdk.SearchScope scope, Integer pageSize, String filter, String... attributes) Deprecated.User management has been reworked.searchLDAPGroups(com.unboundid.ldap.sdk.LDAPConnection con, String baseDn, Integer pageSize) searchLDAPGroups(LDAPGruppe gruppe, MandantLdapData data) Deprecated.UsesearchLDAPGroups(LDAPConnection, String, Integer)instead.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.
-
Constructor Details
-
LDAPDataUtil
public LDAPDataUtil()
-
-
Method Details
-
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
-
searchEntriesFlat
public static List<com.unboundid.ldap.sdk.SearchResultEntry> searchEntriesFlat(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 flattened results.- Parameters:
con- Connection to the active directory.baseDN- Base DN where to start the search.scope- The scope for the search.pageSize- If null or less than or equal to0, no paging is applied. Otherwise, reads the result in batches by making multiple requests.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:
- All results that were 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.
-
searchEntriesFlat
public static List<com.unboundid.ldap.sdk.SearchResultEntry> searchEntriesFlat(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 flattened results.- Parameters:
con- Connection to the active directory.baseDN- Base DN where to start the search.scope- The scope for the search.pageSize- If null or less than or equal to0, no paging is applied. Otherwise, reads the result in batches by making multiple requests.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:
- All results that were 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, 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.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.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:
- All results that were 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.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.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:
- All results that were 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.JSONException Performs 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.JSONException Performs 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.LDAPException Performs 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.LDAPException Performs 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.
-
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(com.unboundid.ldap.sdk.LDAPConnection con, String baseDn, Integer pageSize) throws com.unboundid.ldap.sdk.LDAPException, GeneralSecurityException - Throws:
com.unboundid.ldap.sdk.LDAPExceptionGeneralSecurityException
-
getDNResultList
-
getUserLoginAttribute
public static com.unboundid.ldap.sdk.Attribute getUserLoginAttribute(com.unboundid.ldap.sdk.SearchResultEntry entry) -
getUserIdAttribute
public static com.unboundid.ldap.sdk.Attribute getUserIdAttribute(com.unboundid.ldap.sdk.SearchResultEntry entry, String attrName) -
getTotalCount
@Deprecated 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 Deprecated.usegetTotalCount(LDAPConnection, String, SearchScope, Integer, Filter)instead. When querying the total count of entries, there is no need to specify attributes, as they are not used in the counting process.Returns the total count of entries that match the given filter. If paging is applied, this method will perform multiple queries to the LDAP server and sum up the counts of each page. If no paging is applied, this method will perform a single query and return the count of the returned entries.- Parameters:
con- Connection to the active directory.baseDN- Base DN where to start the search.scope- The scope for the search.pageSize- If null or less than or equal to0, no paging is applied and the count of the returned entries is returned. Otherwise, results are retrieved in batches of the given page size, and the counts of each batch are summed up and returned.filter- A filter for limiting the search results.attributes- An optional list of attributes that should be queried. This method will ignore the returned attributes and only return the count of the returned entries- Returns:
- the total count of entries that match the given filter.
- Throws:
com.unboundid.ldap.sdk.LDAPException
-
getTotalCount
@Deprecated 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 Deprecated.usegetTotalCount(LDAPConnection, String, SearchScope, Integer, Filter)instead. When querying the total count of entries, there is no need to specify attributes, as they are not used in the counting process.Returns the total count of entries that match the given filter. If paging is applied, this method will perform multiple queries to the LDAP server and sum up the counts of each page. If no paging is applied, this method will perform a single query and return the count of the returned entries.- Parameters:
con- Connection to the active directory.baseDN- Base DN where to start the search.scope- The scope for the search.pageSize- If null or less than or equal to0, no paging is applied and the count of the returned entries is returned. Otherwise, results are retrieved in batches of the given page size, and the counts of each batch are summed up and returned.filter- A filter for limiting the search results.attributes- An optional list of attributes that should be queried. This method will ignore the returned attributes and only return the count of the returned entries- Returns:
- the total count of entries that match the given filter.
- 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) throws com.unboundid.ldap.sdk.LDAPException Returns the total count of entries that match the given filter. If paging is applied, this method will perform multiple queries to the LDAP server and sum up the counts of each page. If no paging is applied, this method will perform a single query and return the count of the returned entries. This method uses theSearchRequest.NO_ATTRIBUTESconstant to indicate that no attributes should be returned, as they are not used in the counting process.- Parameters:
con- Connection to the active directory.baseDN- Base DN where to start the search.scope- The scope for the search.pageSize- If null or less than or equal to0, no paging is applied and the count of the returned entries is returned. Otherwise, results are retrieved in batches of the given page size, and the counts of each batch are summed up and returned.filter- A filter for limiting the search results.- Throws:
com.unboundid.ldap.sdk.LDAPException
-
getObjectIDAsString
-
getObjectIDAttribute
public static com.unboundid.ldap.sdk.Attribute getObjectIDAttribute(com.unboundid.ldap.sdk.SearchResultEntry entry) -
getObjectIDAttribute
- Throws:
ParseException
-
getObjectID
-
getObjectID
public static byte[] getObjectID(com.unboundid.ldap.sdk.SearchResultEntry entry) -
searchLDAPGroups
@Deprecated public static List<String> searchLDAPGroups(LDAPGruppe gruppe, MandantLdapData data) throws com.unboundid.ldap.sdk.LDAPException, GeneralSecurityException Deprecated.UsesearchLDAPGroups(LDAPConnection, String, Integer)instead.- Throws:
com.unboundid.ldap.sdk.LDAPExceptionGeneralSecurityException
-
searchLDAPBenutzer
@Deprecated 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 Deprecated.User management has been reworked. Users may have multiple identities to sign in with.- Throws:
com.unboundid.ldap.sdk.LDAPException
-
searchLDAPBenutzer
@Deprecated 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 Deprecated.User management has been reworked. Users may have multiple identities to sign in with.- Throws:
com.unboundid.ldap.sdk.LDAPException
-
getTotalCount(LDAPConnection, String, SearchScope, Integer, Filter)instead.