diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 166a7ff3bce64101b801ab5ff0d822177d6cd8aa..d2f850d53e353fe9ae3d5dd175a3e88561b99076 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -15,6 +15,7 @@ variables: GCP_SERVICE: seismic-store-service GCP_VENDOR: gcp #ibm variables + IBM: 'true' IBM_OPENSHIFT_PROJECT: og-cicd IBM_VENDOR: ibm diff --git a/devops/scripts/ibm_jwt_client.py b/devops/scripts/ibm_jwt_client.py new file mode 100644 index 0000000000000000000000000000000000000000..0653b78ac81e2663de15c38f5b4a6c59a1ae5f7b --- /dev/null +++ b/devops/scripts/ibm_jwt_client.py @@ -0,0 +1,22 @@ +import os +import requests +import json + +url = os.getenv('KEYCLOAK_URL') +client_id = os.getenv('KEYCLOAK_CLIENT_ID') +client_secret = os.getenv('KEYCLOAK_CLIENT_SECRET') +user = os.getenv('AUTH_USER_ACCESS') +password = os.getenv('AUTH_USER_ACCESS_PASSWORD') + +payload = "grant_type=password&client_id="+client_id+"&client_secret="+client_secret+"&username="+user+"&password="+password+"&scope=openid" +headers = { + 'Content-Type': "application/x-www-form-urlencoded" + } +full_url="https://"+url+"/auth/realms/OSDU/protocol/openid-connect/token" +response = requests.request("POST", full_url, data=payload, headers=headers) + +print(response.text) + +result = response.json() +token = result['access_token'] +print(token)