From 9712ec90624d083f2b2d128862e2e4f32851c147 Mon Sep 17 00:00:00 2001 From: Giancarlo Panichi Date: Wed, 1 Feb 2023 17:47:25 +0100 Subject: [PATCH] First Commit --- src/iamexample/iamexample.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/iamexample/iamexample.py b/src/iamexample/iamexample.py index 5fe3b13..555b8a5 100644 --- a/src/iamexample/iamexample.py +++ b/src/iamexample/iamexample.py @@ -15,10 +15,10 @@ class IAMExample: self.iamURL = 'https://accounts.dev.d4science.org/auth/realms/d4science/protocol/openid-connect/token' self.call = sys.argv[1] self.clientId = sys.argv[2] - self.secret = sys.argv[3] + self.clientSecret = sys.argv[3] print('Call: ' + self.call) print('ClientId: ' + self.clientId) - print('Secret: ' + self.secret) + print('ClientSecret: ' + self.clientSecret) def main(self): if self.call== "AccessToken": @@ -32,7 +32,7 @@ class IAMExample: def getAccessToken(self): print("getAccessToken()") loginheaders = { 'Accept' : 'application/json', 'Content-Type' : 'application/x-www-form-urlencoded'} - logindata = { 'grant_type' : 'client_credentials', 'client_id' : self.clientId, 'client_secret' : self.secret} + logindata = { 'grant_type' : 'client_credentials', 'client_id' : self.clientId, 'client_secret' : self.clientSecret } # Get Access Token by client_id resp1 = requests.post(self.iamURL, data=logindata, headers=loginheaders) @@ -63,8 +63,7 @@ class IAMExample: print("Resp2: ",jwt2) umaToken=jwt2["access_token"] return umaToken - - + def __str__(self): return 'IAMExample'