Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Open Subsurface Data Universe Software
Platform
System
SDKs
Python SDK
Commits
e237757f
Commit
e237757f
authored
Feb 27, 2020
by
Spencer Sutton
Browse files
updating to previous changes
parent
675a44a6
Changes
2
Hide whitespace changes
Inline
Side-by-side
osdu_api/provider/aws/entitlements_client.py
View file @
e237757f
...
...
@@ -3,20 +3,22 @@ import boto3
#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
'''
def
get_bearer_token
():
ACCESS_KEY
=
os
.
environ
.
get
(
'AWS_ACCESS_KEY_ID'
)
SECRET_KEY
=
os
.
environ
.
get
(
'AWS_SECRET_ACCESS_KEY'
)
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'
)
PWD
=
os
.
environ
.
get
(
'AWS_COGNITO_AUTH_PARAMS_PASSWORD'
)
client
=
boto3
.
client
(
'cognito-idp'
,
region_name
=
COGNITO_REGION
,
aws_access_key_id
=
ACCESS_KEY
,
aws_secret_access_key
=
SECRET_KEY
aws_secret_access_key
=
SECRET_KEY
,
)
response
=
client
.
initiate_auth
(
...
...
@@ -28,4 +30,4 @@ def get_bearer_token():
}
)
return
f
'Bearer %s'
%
response
[
'AuthenticationResult'
][
'AccessToken'
]
return
response
[
'AuthenticationResult'
][
'AccessToken'
]
\ No newline at end of file
osdu_api/test/osdu_api.yaml
View file @
e237757f
storage_url
:
http://
localhost:8081
/api/storage/v2/records
storage_url
:
http
s
://
d2o4pfwlgp5525.cloudfront.net
/api/storage/v2/records
search_url
:
http://localhost:8085/api/search/v2/query
data_partition_id
:
stubbed_partition
data_partition_id
:
opendes
# dynamically injects what provider-specific logic to use
provider
:
stubbed_provider
provider
:
aws
entitlements_module_name
:
entitlements_client
\ No newline at end of file
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment