use of com.amazonaws.auth.STSAssumeRoleSessionCredentialsProvider in project iep by Netflix.
the class AwsClientFactoryTest method createCredentialsProviderOverride.
@Test
public void createCredentialsProviderOverride() throws Exception {
AwsClientFactory factory = new AwsClientFactory(config);
AWSCredentialsProvider creds = factory.createCredentialsProvider("ec2-test", null);
Assert.assertTrue(creds instanceof STSAssumeRoleSessionCredentialsProvider);
Assert.assertEquals("arn:aws:iam::1234567890:role/IepTest", getField(creds, "roleArn"));
Assert.assertEquals("iep", getField(creds, "roleSessionName"));
}
use of com.amazonaws.auth.STSAssumeRoleSessionCredentialsProvider in project iep by Netflix.
the class AwsClientFactoryTest method createCredentialsProviderForAccount.
@Test
public void createCredentialsProviderForAccount() throws Exception {
AwsClientFactory factory = new AwsClientFactory(config);
AWSCredentialsProvider creds = factory.createCredentialsProvider("ec2-account", "123");
Assert.assertTrue(creds instanceof STSAssumeRoleSessionCredentialsProvider);
Assert.assertEquals("arn:aws:iam::123:role/IepTest", getField(creds, "roleArn"));
Assert.assertEquals("iep", getField(creds, "roleSessionName"));
}
use of com.amazonaws.auth.STSAssumeRoleSessionCredentialsProvider in project iep by Netflix.
the class AwsClientFactoryTest method createCredentialsProviderForAccountIgnored.
@Test
public void createCredentialsProviderForAccountIgnored() throws Exception {
AwsClientFactory factory = new AwsClientFactory(config);
AWSCredentialsProvider creds = factory.createCredentialsProvider("ec2-test", "123");
Assert.assertTrue(creds instanceof STSAssumeRoleSessionCredentialsProvider);
Assert.assertEquals("arn:aws:iam::1234567890:role/IepTest", getField(creds, "roleArn"));
Assert.assertEquals("iep", getField(creds, "roleSessionName"));
}
use of com.amazonaws.auth.STSAssumeRoleSessionCredentialsProvider in project beam by apache.
the class AwsModuleTest method testSTSAssumeRoleSessionCredentialsProviderSerializationDeserialization.
@Test
public void testSTSAssumeRoleSessionCredentialsProviderSerializationDeserialization() throws Exception {
String roleArn = "arn:aws:iam::000111222333:role/TestRole";
String roleSessionName = "roleSessionName";
STSAssumeRoleSessionCredentialsProvider credentialsProvider = new STSAssumeRoleSessionCredentialsProvider.Builder(roleArn, roleSessionName).build();
String serializedCredentialsProvider = objectMapper.writeValueAsString(credentialsProvider);
AWSCredentialsProvider deserializedCredentialsProvider = objectMapper.readValue(serializedCredentialsProvider, AWSCredentialsProvider.class);
assertEquals(credentialsProvider.getClass(), deserializedCredentialsProvider.getClass());
assertEquals(roleArn, readField(deserializedCredentialsProvider, "roleArn", true));
assertEquals(roleSessionName, readField(deserializedCredentialsProvider, "roleSessionName", true));
}
Aggregations