diff --git a/provider/notification-aws/src/main/java/org/opengroup/osdu/notification/provider/aws/impl/ServiceAccountJwtAwsClientImpl.java b/provider/notification-aws/src/main/java/org/opengroup/osdu/notification/provider/aws/impl/ServiceAccountJwtAwsClientImpl.java index 21e1efe20b86c6a004830f3b1f63b8b481cc2eff..dfc735be7bb4fa64c0afdfd868e0e0c9f77bf169 100644 --- a/provider/notification-aws/src/main/java/org/opengroup/osdu/notification/provider/aws/impl/ServiceAccountJwtAwsClientImpl.java +++ b/provider/notification-aws/src/main/java/org/opengroup/osdu/notification/provider/aws/impl/ServiceAccountJwtAwsClientImpl.java @@ -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"); diff --git a/provider/notification-aws/src/main/resources/application.properties b/provider/notification-aws/src/main/resources/application.properties index 85634d7e67082a22a831db827d8645078f882600..cfccbdec8a2adc65bd8952cdb11bfcfc86fc6813 100644 --- a/provider/notification-aws/src/main/resources/application.properties +++ b/provider/notification-aws/src/main/resources/application.properties @@ -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