Last active
July 28, 2021 13:58
-
-
Save edegula/245f8089da780d404fac8f01292ac694 to your computer and use it in GitHub Desktop.
CPI - Get Credentials from Secure Store
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What are the libraries that need to be provided here?