Class LDAPIdentityStore
- java.lang.Object
-
- org.keycloak.storage.ldap.idm.store.ldap.LDAPIdentityStore
-
- All Implemented Interfaces:
IdentityStore
public class LDAPIdentityStore extends Object implements IdentityStore
An IdentityStore implementation backed by an LDAP directory- Author:
- Shane Bryzak, Anil Saldhana, Pedro Silva
-
-
Constructor Summary
Constructors Constructor Description LDAPIdentityStore(KeycloakSession session, LDAPConfig config)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(LDAPObject ldapObject)Persists the specified IdentityTypevoidaddMemberToGroup(String groupDn, String memberAttrName, String value)Adds a member to a group.protected voidcheckRename(LDAPObject ldapObject)intcountQueryResults(LDAPQuery identityQuery)protected StringBuildercreateIdentityTypeSearchFilter(LDAPQuery identityQuery)protected BasicAttributesextractAttributesForSaving(LDAPObject ldapObject, boolean isCreate)List<LDAPObject>fetchQueryResults(LDAPQuery identityQuery)LDAPConfiggetConfig()Returns the configuration for this IdentityStore instanceprotected StringgetEntryIdentifier(LDAPObject ldapObject)Set<LDAPCapabilityRepresentation>queryServerCapabilities()Query the LDAP server RootDSE and extract theLDAPCapabilityRepresentationof all supported extensions, controls and features the server announces.voidremove(LDAPObject ldapObject)Removes the specified IdentityTypevoidremoveMemberFromGroup(String groupDn, String memberAttrName, String value)Removes a member from a group.voidupdate(LDAPObject ldapObject)Updates the specified IdentityTypevoidupdatePassword(LDAPObject user, String password, LDAPOperationDecorator passwordUpdateDecorator)Updates the specified credential value.voidvalidatePassword(LDAPObject user, String password)Validates the specified credentials.
-
-
-
Constructor Detail
-
LDAPIdentityStore
public LDAPIdentityStore(KeycloakSession session, LDAPConfig config)
-
-
Method Detail
-
getConfig
public LDAPConfig getConfig()
Description copied from interface:IdentityStoreReturns the configuration for this IdentityStore instance- Specified by:
getConfigin interfaceIdentityStore- Returns:
-
add
public void add(LDAPObject ldapObject)
Description copied from interface:IdentityStorePersists the specified IdentityType- Specified by:
addin interfaceIdentityStore
-
addMemberToGroup
public void addMemberToGroup(String groupDn, String memberAttrName, String value)
Description copied from interface:IdentityStoreAdds a member to a group.- Specified by:
addMemberToGroupin interfaceIdentityStore- Parameters:
groupDn- The DN of the group objectmemberAttrName- The member attribute namevalue- The value (it can be uid or dn depending the group type)
-
removeMemberFromGroup
public void removeMemberFromGroup(String groupDn, String memberAttrName, String value)
Description copied from interface:IdentityStoreRemoves a member from a group.- Specified by:
removeMemberFromGroupin interfaceIdentityStore- Parameters:
groupDn- The DN of the group objectmemberAttrName- The member attribute namevalue- The value (it can be uid or dn depending the group type)
-
update
public void update(LDAPObject ldapObject)
Description copied from interface:IdentityStoreUpdates the specified IdentityType- Specified by:
updatein interfaceIdentityStore
-
checkRename
protected void checkRename(LDAPObject ldapObject)
-
remove
public void remove(LDAPObject ldapObject)
Description copied from interface:IdentityStoreRemoves the specified IdentityType- Specified by:
removein interfaceIdentityStore
-
fetchQueryResults
public List<LDAPObject> fetchQueryResults(LDAPQuery identityQuery)
- Specified by:
fetchQueryResultsin interfaceIdentityStore
-
countQueryResults
public int countQueryResults(LDAPQuery identityQuery)
- Specified by:
countQueryResultsin interfaceIdentityStore
-
queryServerCapabilities
public Set<LDAPCapabilityRepresentation> queryServerCapabilities()
Description copied from interface:IdentityStoreQuery the LDAP server RootDSE and extract theLDAPCapabilityRepresentationof all supported extensions, controls and features the server announces. The LDAP Wiki provides a list of known capabilities. Will throw aModelExceptionon any LDAP error, or when the searchResult is empty.- Specified by:
queryServerCapabilitiesin interfaceIdentityStore- Returns:
- a set of LDAPOid, each representing a server capability (control, extension or feature).
-
validatePassword
public void validatePassword(LDAPObject user, String password) throws AuthenticationException
Description copied from interface:IdentityStoreValidates the specified credentials.- Specified by:
validatePasswordin interfaceIdentityStore- Parameters:
user- Keycloak userpassword- Ldap password- Throws:
AuthenticationException- if authentication is not successful
-
updatePassword
public void updatePassword(LDAPObject user, String password, LDAPOperationDecorator passwordUpdateDecorator)
Description copied from interface:IdentityStoreUpdates the specified credential value.- Specified by:
updatePasswordin interfaceIdentityStore- Parameters:
user- Keycloak userpassword- Ldap passwordpasswordUpdateDecorator- Callback to be executed before/after password update. Can be null
-
createIdentityTypeSearchFilter
protected StringBuilder createIdentityTypeSearchFilter(LDAPQuery identityQuery)
-
extractAttributesForSaving
protected BasicAttributes extractAttributesForSaving(LDAPObject ldapObject, boolean isCreate)
-
getEntryIdentifier
protected String getEntryIdentifier(LDAPObject ldapObject)
-
-