Skip to content
Snippets Groups Projects
Commit 9fbb6227 authored by Rucha Deshpande's avatar Rucha Deshpande
Browse files

Bug fix: add custom scope as env. var

parent 71e207d5
No related branches found
No related tags found
1 merge request!137Aws xuserid fix
......@@ -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");
......
......@@ -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
......
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