Reputation: 556
Problem description: I need to get username and password for a (human) user that logs in to a Jenkins Web UI to pass those as parameters to a script that uses LDAP to verify credentials. The LDAP python script is here, http://blog.emfeld.com/2013/03/ldap-login-authentication-using-python.html. So far, I have only been able to found a groovy script that finds credentials looking at the Credentials Store, but this is not enough as I need to be able to authenticate any user that belongs to the organization. Many thanks.
Upvotes: 0
Views: 1691
Reputation: 111625
The question doesn't seem 100% clear to me, but you can't fetch a user's password from Jenkins, and especially not if Jenkins is using LDAP as the authentication method, as the LDAP server is external to Jenkins.
You can however fetch the current user's API token from Groovy:
println User.current().getProperty(jenkins.security.ApiTokenProperty.class).getApiToken()
This can be used to make API and CLI calls as that user, but is unrelated to their password.
Upvotes: 1