Commit 7695d6fdb8268c4fba3745f849c1fd7202478952

Authored by George Vlahavas
1 parent c0c5f51149

Use a variable for CLIENT_ID

Showing 1 changed file with 2 additions and 1 deletions

keycloak_test.groovy View file @ 7695d6f
... ... @@ -15,6 +15,7 @@
15 15 KEYCLOAK_URL = "https://keycloak-curex.gnubila.fr/auth/realms/Integration/protocol/openid-connect/token"
16 16 USER = credentials('keycloak-test-user')
17 17 PASSWORD = credentials('keycloak-test-password')
  18 + CLIENT_ID = "KEA"
18 19  
19 20 }
20 21  
... ... @@ -36,7 +37,7 @@
36 37 }
37 38  
38 39 testName = "KEA_keycloak_success"
39   - String token = sh(label: "KEA_keycloak_token", script: "curl -s -X POST $KEYCLOAK_URL -H 'Content-Type: application/x-www-form-urlencoded' -d 'username=$USER' -d 'password=$PASSWORD' -d 'grant_type=password' -d 'client_id=KEA' | sed 's/.*access_token\":\"//g' | sed 's/\".*//g'", returnStdout: true)
  40 + String token = sh(label: "get_keycloak_token", script: "curl -s -X POST $KEYCLOAK_URL -H 'Content-Type: application/x-www-form-urlencoded' -d 'username=$USER' -d 'password=$PASSWORD' -d 'grant_type=password' -d 'client_id=$CLIENT_ID' | sed 's/.*access_token\":\"//g' | sed 's/\".*//g'", returnStdout: true)
40 41 responseCode = sh(label: testName, script: "curl -m 10 -sLI -w '%{http_code}' -H 'Authorization: Bearer $token' -H 'Accept: application/json, text/plain, */*' $url -o /dev/null", returnStdout: true)
41 42 if ( responseCode != '200' ) {
42 43 error("$testName: Returned status code = $responseCode when calling $url")