Commit 5c94fabd authored by Bill Wang's avatar Bill Wang Committed by Sutton
Browse files

Squashed commit of the following

commit 04e49a0d 
Author: zhijie wang <wanzhiji@amazon.com> 
Date: Mon Dec 28 2020 19:10:30 GMT-0800 (Pacific Standard Time) 

    fix Cognito region services


commit fca15a32 
Author: zhijie wang <wanzhiji@amazon.com> 
Date: Mon Dec 28 2020 13:56:14 GMT-0800 (Pacific Standard Time) 

commit eaf5dcc4 
Author: zhijie wang <wanzhiji@amazon.com> 
Date: Mon Dec 28 2020 13:35:25 GMT-0800 (Pacific Standard Time) 

    fix cognito client


commit 9ceee335 
Author: zhijie wang <wanzhiji@amazon.com> 
Date: Mon Dec 28 2020 13:20:15 GMT-0800 (Pacific Standard Time) 

    bump core service version


commit 30d44fe4 
Author: zhijie wang <wanzhiji@amazon.com> 
Date: Mon Dec 21 2020 15:03:10 GMT-0800 (Pacific Standard Time) 

    fix pom version
parent 7883a8b8
......@@ -28,8 +28,8 @@ phases:
java: corretto8
commands:
- if [ $(echo $CODEBUILD_SOURCE_VERSION | grep -c ^refs/heads.*) -eq 1 ]; then echo "Branch name found"; else echo "This build only supports branch builds" && exit 1; fi
- apt-get update -y
- apt-get install -y maven
- apt-get update -y -qq > /dev/null
- apt-get install -y maven -qq >/dev/null
- java -version
- mvn -version
- mkdir -p /root/.m2
......@@ -56,7 +56,7 @@ phases:
- printenv
- echo "Building primary service assemblies..."
- mvn -B test install -pl notification-core,provider/notification-aws -Ddeployment.environment=prod
- mvn -ntp -B test install -pl notification-core,provider/notification-aws -Ddeployment.environment=prod
- echo "Building integration testing assemblies and gathering artifacts..."
- ./testing/notification-test-aws/build-aws/prepare-dist.sh
......
......@@ -48,7 +48,7 @@
<dependency>
<groupId>org.opengroup.osdu.core.aws</groupId>
<artifactId>os-core-lib-aws</artifactId>
<version>0.3.14</version>
<version>0.3.16</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.amazonaws/aws-java-sdk-secretsmanager -->
......
......@@ -79,10 +79,12 @@ public class AwsCognitoClient {
public static AWSCognitoIdentityProvider generateCognitoClient(String region)
{
return AWSCognitoIdentityProviderClientBuilder.standard()
.withCredentials(IAMConfig.amazonAWSCredentials())
.withRegion(region)
.build();
if (System.getenv("AWS_COGNITO_REGION") != null) {
region = System.getenv("AWS_COGNITO_REGION");
}
return AWSCognitoIdentityProviderClientBuilder.standard().
withCredentials(IAMConfig.amazonAWSCredentials()).
withRegion(region).build();
}
public void setPassword(String username, String password,String userPoolId){
......
......@@ -85,9 +85,14 @@ public class AwsCognitoClient {
public static AWSCognitoIdentityProvider generateCognitoClient()
{
return AWSCognitoIdentityProviderClientBuilder.standard()
.withCredentials(IAMConfig.amazonAWSCredentials())
.withRegion(AwsConfig.getAwsRegion())
.build();
String region = System.getenv("AWS_COGNITO_REGION");
AWSCognitoIdentityProviderClientBuilder builder = AWSCognitoIdentityProviderClientBuilder.standard()
.withCredentials(IAMConfig.amazonAWSCredentials());
if ( region!= null) {
builder.withRegion(region);
}else{
builder.withRegion(AwsConfig.getAwsRegion());
}
return builder.build();
}
}
Markdown is supported
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