I have found a way to access the credentials store in Jenkins:
def getPassword = { username ->
def creds = com.cloudbees.plugins.credentials.CredentialsPr
If you just want to retrieve the credentials for a given credentials ID, the simplest way is to use the withCredentials pipeline step to bind credentials to variables.
withCredentials([usernamePassword( credentialsId: 'myCredentials',
usernameVariable: 'MYUSER', passwordVariable: 'MYPWD' )]) {
echo "User: $MYUSER, Pwd: $MYPWD"
}