Commit 0b07a0c7 authored by Wyatt Nielsen's avatar Wyatt Nielsen
Browse files

Latest pull from ado

parent e51df0e1
...@@ -3,22 +3,20 @@ import boto3 ...@@ -3,22 +3,20 @@ import boto3
#TODO: look at using secrets manager to hold cognito credentials #TODO: look at using secrets manager to hold cognito credentials
''' '''
Reaches out to aws cognito for a valid user's token based on environment variables. Reaches out to aws cognito for a valid user's token based on environment variables.
The same pattern is used in OSDU java microservices' integration tests The same pattern is used in OSDU java microservices' integration tests
''' '''
def get_bearer_token(): def get_bearer_token():
ACCESS_KEY = os.environ.get('AWS_ACCESS_KEY_ID') ACCESS_KEY = os.environ.get('AWS_ACCESS_KEY_ID')
SECRET_KEY = os.environ.get('AWS_SECRET_ACCESS_KEY') SECRET_KEY = os.environ.get('AWS_SECRET_ACCESS_KEY')
CLIENT_ID = os.environ.get('AWS_COGNITO_CLIENT_ID') CLIENT_ID = os.environ.get('AWS_COGNITO_CLIENT_ID')
COGNITO_REGION = os.environ.get('AWS_COGNITO_REGION')
USER = os.environ.get('AWS_COGNITO_AUTH_PARAMS_USER') USER = os.environ.get('AWS_COGNITO_AUTH_PARAMS_USER')
PWD = os.environ.get('AWS_COGNITO_AUTH_PARAMS_PASSWORD') PWD = os.environ.get('AWS_COGNITO_AUTH_PARAMS_PASSWORD')
client = boto3.client( client = boto3.client(
'cognito-idp', 'cognito-idp',
region_name=COGNITO_REGION,
aws_access_key_id=ACCESS_KEY, aws_access_key_id=ACCESS_KEY,
aws_secret_access_key=SECRET_KEY, aws_secret_access_key=SECRET_KEY
) )
response = client.initiate_auth( response = client.initiate_auth(
...@@ -30,4 +28,4 @@ def get_bearer_token(): ...@@ -30,4 +28,4 @@ def get_bearer_token():
} }
) )
return 'Bearer ' + response['AuthenticationResult']['AccessToken'] return f'Bearer %s' % response['AuthenticationResult']['AccessToken']
\ No newline at end of file
storage_url: https://d2o4pfwlgp5525.cloudfront.net/api/storage/v2/records storage_url: http://localhost:8081/api/storage/v2/records
search_url: http://localhost:8085/api/search/v2/query search_url: http://localhost:8085/api/search/v2/query
data_partition_id: opendes data_partition_id: stubbed_partition
# dynamically injects what provider-specific logic to use # dynamically injects what provider-specific logic to use
provider: aws provider: stubbed_provider
entitlements_module_name: entitlements_client entitlements_module_name: entitlements_client
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment