You may map LDAP groups with SSO users through the use of Artifactory User Plugins. The full process for working with this plugin is as follows:
<Setup LDAP & LDAP Group>
- Download 'SynchornizeLDAPGroups' user plugin and place it under your $ARTIFACTORY_HOME/etc/plugins (or $CLUSTER_HOME/etc/plugins if you are using High Availability)
- Replace "il-users" with the name of your LDAP group that has been imported to Artifactory
- Inside "myrelms", add the following line to the plugin for debugging purposes only: log.debug "user " + username+" have the following groups "+ groups
- Add the following logging to the $ARTIFACTORY_HOME/etc/logback.xml : (no need for restart)
<logger name="synchronizeLdapGroups"> <level value="debug"/> </logger>
- After adding the user plugin run the plugin reload rest api or restart Artifactory.
- In order to check that SSO user is getting the right groups as he/she has in the LDAP group, an existing user named 'shayy'. You can see that this user doesn't exist in Artifactory:
- I've imported the LDAP group which I want the user to get its permissions. In this case, as in the plugin we used the 'il-users'. I've imported 2 groups that are part of the 'il-users'.
- Once I had those groups in Artifactory, I've created a simple SSO config so I can authenticate with a user and sync the LDAP groups this user have. Meaning that once I will login using this SSO user the plugin will give it the groups that this user have on LDAP.
- Run the following rest command: curl -i -H "REMOTE_USER:shayy" http://localhost:8081/artifactory/api/system/ping
As you can see this will provide the SSO with the header that it expects in order to authenticate the user.
- Once doing so the user was created with its default permissions.
- If you go to the artifactory.log you will be able to see that actually, although the UI doesn't show it, the debug line we added will show you that the user is part of the groups as he has on his LDAP server. See ArtifactoryLogAfterSSO.png. This is due to the fact that the plugin will add the permissions per session and not as constant groups per user.
- In case you try to use this user with a permission that he has on the LDAP server, it will succeed as the plugin will attach those groups permission to this user.
Disclaimer: The REMOTE_USER header is attached to the client request in this tutorial for demonstration purposes only. In a real-world setup, this header is meant to be set a proxying entity that forwards request to Artifactory, after it verifies the identity of the user on the request, usually against some other identity provider (for example Active Directory with Kerberos). You may also review our Apache HTTPD HTTP SSO solution.