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
Notification
Commits
9fbb6227
Commit
9fbb6227
authored
Nov 13, 2020
by
Rucha Deshpande
Browse files
Bug fix: add custom scope as env. var
parent
71e207d5
Changes
2
Hide whitespace changes
Inline
Side-by-side
provider/notification-aws/src/main/java/org/opengroup/osdu/notification/provider/aws/impl/ServiceAccountJwtAwsClientImpl.java
View file @
9fbb6227
...
...
@@ -73,6 +73,9 @@ public class ServiceAccountJwtAwsClientImpl implements IServiceAccountJwtClient
@Getter
()
public
String
tokenUrl
;
@Value
(
"${aws.oauth.custom.scope}"
)
private
String
awsOauthCustomScope
;
@Autowired
private
JaxRsDpsLog
log
;
...
...
@@ -106,7 +109,6 @@ public class ServiceAccountJwtAwsClientImpl implements IServiceAccountJwtClient
client_credentials_clientid
=
paramsResult
.
getValue
();
client_credentials_secret
=
getSecret
(
client_secret_secretName
,
amazonRegion
,
client_secret_key
);
}
}
...
...
@@ -128,14 +130,15 @@ public class ServiceAccountJwtAwsClientImpl implements IServiceAccountJwtClient
headers
.
put
(
"Authorization"
,
"Basic "
+
authorizationHeaderContents
);
headers
.
put
(
"Content-Type"
,
"application/x-www-form-urlencoded"
);
IHttpClient
httpClient
=
new
HttpClient
();
String
url
=
tokenUrl
+
"?grant_type=client_credentials&client_id="
+
client_credentials_clientid
+
"&scope=
osduOnAws/fromNotificaton"
;
String
url
=
tokenUrl
+
"?grant_type=client_credentials&client_id="
+
client_credentials_clientid
+
"&scope=
"
+
awsOauthCustomScope
;
HttpRequest
rq
=
HttpRequest
.
post
().
url
(
url
).
headers
(
headers
).
build
();
HttpResponse
result
=
httpClient
.
send
(
rq
);
try
{
AccessToken
accessToken
=
this
.
getResult
(
result
,
AccessToken
.
class
);
token
=
accessToken
.
getAccess_token
();
token
=
accessToken
.
getAccess_token
();
}
catch
(
Exception
e
)
{
System
.
out
.
println
(
"Could not parse AccessToken result to get access_token"
);
...
...
provider/notification-aws/src/main/resources/application.properties
View file @
9fbb6227
...
...
@@ -29,6 +29,7 @@ aws.dynamodb.table.prefix=${RESOURCE_PREFIX}-
aws.dynamodb.endpoint
=
dynamodb.${AWS_REGION}.amazonaws.com
aws.tokenUrl
=
${OAUTH_TOKEN_URL}
aws.oauth.custom.scope
=
${OAUTH_CUSTOM_SCOPE}
app.expireTime
=
300
app.maxCacheSize
=
10
...
...
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