Code development platform for open source projects from the European Union institutions

Skip to content
Snippets Groups Projects
Commit 20c3cd0e authored by Andre Marcelo FERREIRA FREIRE TEIXEIRA's avatar Andre Marcelo FERREIRA FREIRE TEIXEIRA
Browse files

Some improvements in csui application

parent b92efcb2
No related branches found
No related tags found
No related merge requests found
......@@ -18,26 +18,32 @@ http_proxy = 'http://x50l002:x52503@vip-proxy-l4s.snmc.cec.eu.int:8012'
#TODO -> necessary check via ini files the enviorment - create a specofic ini file for that
username = 'DIGIT-WS-SNET-SMART'
namespace_used = "EC/DIGIT_C4_SNET_ADMIN-ACC"
base_url = "https://digituat.service-now.com/api/emdig/v1/itsm"
vault_url = "https://sam-hcavault.cec.eu.int"
if IS_DEV or IS_ACC :
namespace_used = "EC/DIGIT_C4_SNET_ADMIN-ACC"
base_url = "https://digituat.service-now.com/api/emdig/v1/itsm"
vault_url = "https://sam-hcavault.cec.eu.int"
if IS_DEV:
print('IS DEV')
engine = "dev"
#Approle approle-dev-csui-change-mgmt
role_id_read = "445043ec-398c-fc4d-39f3-00f915eb3049"
secret_approle_read = "f2144b45-2e36-f3b6-1a4c-7a5b05a470bf"
role_id_read = '3d20c565-ae1f-25dc-ba39-f17f20beb18e'
secret_approle_read = '50cf5e80-e509-708c-707a-29c127714bc5'
elif IS_ACC :
print('IS ACC')
engine = "acc"
role_id_read = 'a516f820-6f9f-d963-9807-2aef7aeb3612'
secret_approle_read = '37dfe79f-33f7-2fde-c412-86c43d7bbe50'
else :
print('IS PROD')
namespace_used = "EC/DIGIT_C4_SNET_ADMIN-PROD"
base_url = "https://digit.service-now.com/api/emdig/v1/itsm"
vault_url = "https://sam-hcpvault.cec.eu.int"
engine = 'prod'
#Approle approle-prod-csui-change-mgmt
role_id_read = "445043ec-398c-fc4d-39f3-00f915eb3049"
secret_approle_read = "f2144b45-2e36-f3b6-1a4c-7a5b05a470bf"
password = clientV.getPasswordByAppRole("apps-kv/"+engine+"/SNOW", vault_url, namespace_used, role_id_read, secret_approle_read)
role_id_read = 'd6717ad9-75db-37f2-363d-50f21a52408a'
secret_approle_read = 'f13d0bbb-03ce-d470-27b3-8f606f3e86bf'
#password = clientV.getPasswordByAppRole("apps-kv/"+engine+"/SNOW", vault_url, namespace_used, role_id_read, secret_approle_read)
password = "+Xg76;CwCr4TgBCs"
credentials = f"{username}:{password}"
encoded_credentials = base64.b64encode(credentials.encode("utf-8")).decode("utf-8")
authorization = f"Basic {encoded_credentials}"
......
......@@ -26,10 +26,11 @@ class Vault(object):
client.token = response['auth']['client_token']
secret = self.getPasswordViaToken(key, vault_url, namespace_used, client.token )
secret_data = False
if secret is not None:
if secret is not None and len(secret['errors']) == 0 and 'data' in secret:
secret_data = secret['data']['data']['password']
#print(secret_data)
else:
print(secret, "secret")
print("Failed to retrieve the secret.")
client.logout()
return secret_data
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment