use of software.amazon.awssdk.auth.credentials.AwsCredentialsProvider in project flink by apache.
the class GlueSchemaRegistryJsonSchemaCoderTest method testAwsCredentialsProviderFromConfig.
@Test
public void testAwsCredentialsProviderFromConfig() throws Exception {
Map<String, Object> config = new HashMap<>(getBaseConfig());
config.put(AWS_ACCESS_KEY_ID, "ak");
config.put(AWS_SECRET_ACCESS_KEY, "sk");
GlueSchemaRegistryJsonSchemaCoder coder = new GlueSchemaRegistryJsonSchemaCoder("test", config);
GlueSchemaRegistryDeserializationFacade facade = getField("glueSchemaRegistryDeserializationFacade", coder);
AwsCredentialsProvider credentialsProvider = facade.getCredentialsProvider();
assertThat(credentialsProvider.resolveCredentials().accessKeyId()).isEqualTo("ak");
assertThat(credentialsProvider.resolveCredentials().secretAccessKey()).isEqualTo("sk");
}
use of software.amazon.awssdk.auth.credentials.AwsCredentialsProvider in project flink by apache.
the class AWSGeneralUtilTest method testGetCredentialsProviderAuto.
@Test
public void testGetCredentialsProviderAuto() {
Properties properties = TestUtil.properties(AWS_CREDENTIALS_PROVIDER, "AUTO");
AwsCredentialsProvider credentialsProvider = AWSGeneralUtil.getCredentialsProvider(properties);
assertTrue(credentialsProvider instanceof DefaultCredentialsProvider);
}
use of software.amazon.awssdk.auth.credentials.AwsCredentialsProvider in project flink by apache.
the class AWSGeneralUtilTest method testGetCredentialsProviderAssumeRole.
@Test
public void testGetCredentialsProviderAssumeRole() {
Properties properties = spy(TestUtil.properties(AWS_CREDENTIALS_PROVIDER, "ASSUME_ROLE"));
properties.setProperty(AWS_REGION, "eu-west-2");
AwsCredentialsProvider credentialsProvider = AWSGeneralUtil.getCredentialsProvider(properties);
assertTrue(credentialsProvider instanceof StsAssumeRoleCredentialsProvider);
verify(properties).getProperty(AWSConfigConstants.roleArn(AWS_CREDENTIALS_PROVIDER));
verify(properties).getProperty(AWSConfigConstants.roleSessionName(AWS_CREDENTIALS_PROVIDER));
verify(properties).getProperty(AWSConfigConstants.externalId(AWS_CREDENTIALS_PROVIDER));
verify(properties).getProperty(AWS_REGION);
}
use of software.amazon.awssdk.auth.credentials.AwsCredentialsProvider in project flink by apache.
the class AWSGeneralUtilTest method testGetCredentialsProviderWebIdentityTokenFileCredentialsProvider.
@Test
public void testGetCredentialsProviderWebIdentityTokenFileCredentialsProvider() {
Properties properties = TestUtil.properties(AWS_CREDENTIALS_PROVIDER, "WEB_IDENTITY_TOKEN");
AwsCredentialsProvider credentialsProvider = AWSGeneralUtil.getCredentialsProvider(properties);
assertTrue(credentialsProvider instanceof WebIdentityTokenFileCredentialsProvider);
}
use of software.amazon.awssdk.auth.credentials.AwsCredentialsProvider in project flink by apache.
the class AWSGeneralUtilTest method testGetCredentialsProviderFromMap.
@Test
public void testGetCredentialsProviderFromMap() {
Map<String, Object> config = ImmutableMap.of(AWS_CREDENTIALS_PROVIDER, "AUTO");
AwsCredentialsProvider credentialsProvider = AWSGeneralUtil.getCredentialsProvider(config);
assertTrue(credentialsProvider instanceof DefaultCredentialsProvider);
}
Aggregations