Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def getPassword = { username ->
- def creds = com.cloudbees.plugins.credentials.CredentialsProvider.lookupCredentials(
- com.cloudbees.plugins.credentials.common.StandardUsernamePasswordCredentials.class,
- jenkins.model.Jenkins.instance
- )
- def c = creds.findResult { it.username == username ? it : null }
- if ( c ) {
- println "found credential ${c.id} for username ${c.username}"
- def credentials_store = jenkins.model.Jenkins.instance.getExtensionList(
- 'com.cloudbees.plugins.credentials.SystemCredentialsProvider'
- )[0].getStore()
- println "result: " + credentials_store
- } else {
- println "could not find credential for ${username}"
- }
- }
- getPassword("XYZ")
- result: com.cloudbees.plugins.credentials.SystemCredentialsProvider$StoreImpl@1639eab2
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement