Skip to content
Snippets Groups Projects
Commit aa0d4ee4 authored by OZGCloud's avatar OZGCloud
Browse files

use usermanagerapi user

parent 6b8b47b0
No related branches found
No related tags found
No related merge requests found
......@@ -705,7 +705,7 @@ Map getUserManagerDatabaseSecret(String namespace) {
String getKeycloakUuid(realm, userName) {
def shScript = """curl -H 'Content-Type: application/json' \
-H 'Authorization: bearer ${getKeycloakAccessToken()}' \
-H 'Authorization: bearer ${getKeycloakAccessToken(realm)}' \
'https://${env.SSO_URL}/admin/realms/${realm}/users'
"""
......@@ -720,12 +720,21 @@ String getKeycloakUuid(realm, userName) {
}
}
String getKeycloakAccessToken() {
withCredentials([usernamePassword(credentialsId: 'keycloak-ovh-cluster', usernameVariable: 'USER', passwordVariable: 'PASSWORD')]) {
def token = readJSON text: sh (script: 'curl -d "client_id=admin-cli" -d "username=$USER" -d "password=$PASSWORD" -d "grant_type=password" https://$SSO_URL/realms/master/protocol/openid-connect/token', returnStdout: true)
Map getUserManagerApiUserCredentials(String namespace) {
userManagerApiUserCredentials = readJSON ( text: sh (script: "kubectl get secret usermanagerapiuser-credentials -n ${namespace} -o jsonpath={.data}", returnStdout: true))
return token.access_token
return [
"user": decodeString(userManagerApiUserCredentials.name),
"password": decodeString(userManagerApiUserCredentials.password)
]
}
String getKeycloakAccessToken(String realm) {
userManagerApiUserCredentials = getUserManagerApiUserCredentials(realm)
def token = readJSON text: sh (script: "set +x && curl -d \"client_id=admin-cli\" -d \"username=${userManagerApiUserCredentials.user}\" -d \"password=${userManagerApiUserCredentials.password}\" -d \"grant_type=password\" https://$SSO_URL/realms/$realm/protocol/openid-connect/token", returnStdout: true)
return token.access_token
}
Void sendFailureMessage() {
......
kop:
bezeichner: mastere2eea
environment: dev
e2eTest: true
goofy:
env:
overrideSpringProfiles: "oc,ea,e2e,dev"
......
kop:
bezeichner: mastere2emain
environment: dev
e2eTest: true
goofy:
env:
overrideSpringProfiles: "oc,e2e,dev"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment