Implement LDAP Map storage for users (first implementation stage)#10700
Implement LDAP Map storage for users (first implementation stage)#10700ahus1 wants to merge 1 commit intokeycloak:mainfrom
Conversation
|
@hmlnarik - this is the first draft for a LDAP Map storage for users. It implements a partial storage for users with username, firstname, lastname and email address. All other fields are delegated to a ConcurrentHashMap. I updated the description above on how to run it; I'm looking forward to your feedback on how to proceed. UPDATED: Besides looking for general feedback, I look for answers to the following questions:
|
c383bf6 to
c935cfd
Compare
cc54f65 to
174d35f
Compare
|
@hmlnarik - I gave it another try to extract the federation specific logic from DefaultSingleUserCredentialManager to DefaultSingleUserCredentialManagerStrategy but failed. I put my findings in the JavaDoc:
If you have additional input to that how this could be handled, please provide me with a hint. If not, this will stay as is until there is the legacy module where the code will eventually move to. |
166c6eb to
75aed4d
Compare
|
@hmlnarik - I've rebased the branch. The latest commits include moving moving all methods of UserCredentialStore to the new SingleUserCredentialManager. Due to that, MapUserProvider doesn't implement that interface any more. Looking forward to discuss this next week. |
c2c060c to
814c700
Compare
|
@hmlnarik - this PR now contains two additional commits: (1) 7cf8afe3adc2c22047ae203896ecfbd85fbe04e5 - how to implement the authentication at the "bottom" in the map storage and also to look up the user there. With the data found in LDAP the entity "bubbles up" and it then returned as a User in CredentialValidationOutput. (2) 4a114488de243b16c1cf0a07fd31035928919af6 - minimal changes to KerberosFederationProvider authentication work "at the top", and then it calls findOrCreateAuthenticatedUser() on the store to look up an existing user (can be provided by LDAP with the right attributes already), or to create one. Conflicting users will be deleted. I only tested looking up an existing matching user, I didn't use the creation of a user. Still I would think that this would work with a standard Map provider where it would then create the user if it doesn't exist there. To run the example:
I'd actually prefer option (2) as it only passes in the username. As the username needs to be unique within a realm, the KerberosFederationProvider already does a lot of things the right way. I'm sure there are other things that need to be considered, I'd be happy to hear your thoughts. Thanks! |
4a11448 to
3ed12a5
Compare
|
Hi @hmlnarik - I've been playing around with Active Directory here df792bf on top of this branch's changes. I can now get Keycloak to setup all roles and the admin user via LDAP including setting the password of the admin user and enabling it. Once we've checked LDAP for ApacheDS and Kerberos, that will be next. |
This includes SPNEGO for ApacheDS and ActiveDirectory Closes keycloak#9930
3ed12a5 to
85e009c
Compare
|
@hmlnarik - I've now rebased this PR as the parts of the user credential handling have been implemented when moving over the legacy store. I tested this successfully with Kerberos authentication with Firefox, Keycloak, and ApacheDS. To be able to close #9932, the only change I would need to move over would be the one in MapCredentialValidationOutput.java - this is just about Java generics handling. All other changes around LDAP would need to wait for the tree store. The changes in keycloak-kerberos-federation will need to be revisited, from what I see this could be done after map storage is in the preview phase. Please comment if the way to proceed is:
Thanks. |
|
As announced to the community in this blog post, we are no longer developing the Map Store, and it will be removed from Keycloak's code base. Follow #24111 for the removal steps. |
This is how the implementation can be tested:
-Dkeycloak.user.map.storage.provider=ldap-map-storageWhen running a local Keycloak, the following works:
The password for the user is stored and validated against LDAP.