Skip to content

Instantly share code, notes, and snippets.

@edegula
Last active July 28, 2021 13:58
Show Gist options
  • Save edegula/245f8089da780d404fac8f01292ac694 to your computer and use it in GitHub Desktop.
Save edegula/245f8089da780d404fac8f01292ac694 to your computer and use it in GitHub Desktop.
CPI - Get Credentials from Secure Store
def Message getCredentials( Message message ) {
def service = ITApiFactory.getApi(SecureStoreService.class, null)
def credential = service.getUserCredential("UPLOADED_CREDENTIAL_IN_SECURE_STORE")
if (credential == null){
throw new IllegalStateException("No credential found for alias 'UPLOADED_CREDENTIAL_IN_SECURE_STORE'")
}
String userName = credential.getUsername()
String password = new String(credential.getPassword())
message.setProperty("p_username", userName)
message.setProperty("p_password", password)
message
}
@justexecutee
Copy link

What are the libraries that need to be provided here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment