SHARE
TWEET

Untitled

a guest Apr 20th, 2019 119 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import com.cloudbees.plugins.credentials.*
  2. import com.cloudbees.plugins.credentials.common.*
  3. import com.cloudbees.plugins.credentials.domains.*
  4. import com.cloudbees.plugins.credentials.impl.*
  5. import com.cloudbees.jenkins.plugins.sshcredentials.impl.*
  6. import com.cloudbees.jenkins.plugins.awscredentials.*
  7. import org.jenkinsci.plugins.plaincredentials.impl.*
  8. import hudson.plugins.blazemeter.*
  9.  
  10. domain = Domain.global()
  11. store = SystemCredentialsProvider.getInstance().getStore()
  12.  
  13. for (credential in store.getCredentials(domain)) {
  14.   if (credential instanceof UsernamePasswordCredentialsImpl) {
  15.     println "- usernamePassword:\n    description: " + credential.description + "\n    id: " + credential.id + "\n    scope: " + credential.scope + "\n    username: " + credential.username + "\n    password: " + credential.password.plainText + "\n"
  16.   } else if (credential instanceof StringCredentialsImpl) {
  17.     println "SecretText: " + credential.id + " " + credential.secret.plainText
  18.   } else if(credential instanceof BasicSSHUserPrivateKey) {
  19.     println "SSH: " + credential.id + " " + credential.username + "\n" + credential.privateKey
  20.   } else if(credential instanceof FileCredentialsImpl) {
  21.     println "File: " + credential.id + " " + credential.fileName + "\n" + credential.secretBytes
  22.   } else if(credential instanceof AWSCredentialsImpl) {
  23.     println "- aws:\n    description: " + credential.description + "\n    id: " + credential.id + "\n    accessKey: " + credential.accessKey + "\n    secretKey: " + credential.secretKey.plainText + "\n"
  24.   } else if(credential instanceof BlazemeterCredentialsBAImpl) {
  25.     println "BlazeMeter: " + credential.id + " " + credential.username + " " + credential.password.plainText
  26.   } else {
  27.     println credential.class
  28.     println credential.class.collect{c -> [c.declaredMethods,c.methods]}.flatten()*.name as SortedSet
  29.   }
  30. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top