@Test public void whenInstanceProfileCredentialsInMetadataServiceReturnMapCredentials() throws Exception { server.enqueue(new MockResponse().setBody("route53-readonly")); server.enqueue(new MockResponse().setBody(securityCredentials)); Map<String, String> sessionCredentials = new LinkedHashMap<String, String>(); sessionCredentials.put("accessKey", "AAAAA"); sessionCredentials.put("secretKey", "SSSSSSS"); sessionCredentials.put("sessionToken", "TTTTTTT"); assertThat(new InstanceProfileCredentialsProvider( new ReadFirstInstanceProfileCredentialsOrNull(server .getUrl( InstanceMetadataHook.DEFAULT_URI .getPath()) .toURI())).get( new Route53Provider())) .isEqualTo(MapCredentials.from(sessionCredentials)); assertThat(server.takeRequest()).hasPath("/latest/meta-data/iam/security-credentials/"); assertThat(server.takeRequest()) .hasPath("/latest/meta-data/iam/security-credentials/route53-readonly"); }
@Provides Credentials get(denominator.Provider provider) { return checkValidForProvider(MapCredentials.from(parseJson(iipJsonProvider.get())), provider); }
InstanceProfileCredentialsProvider { @Provides Credentials get(denominator.Provider provider) { return checkValidForProvider(MapCredentials.from(parseJson(iipJsonProvider.get())), provider); } }
InstanceProfileCredentialsProvider { @Provides Credentials get(denominator.Provider provider) { return checkValidForProvider(MapCredentials.from(parseJson(iipJsonProvider.get())), provider); } InstanceProfileCredentialsProvider();  InstanceProfileCredentialsProvider(URI baseUri);  InstanceProfileCredentialsProvider(Provider<String> iipJsonProvider); }
InstanceProfileCredentialsProvider { @Provides Credentials get(denominator.Provider provider) { return checkValidForProvider(MapCredentials.from(parseJson(iipJsonProvider.get())), provider); } InstanceProfileCredentialsProvider();  InstanceProfileCredentialsProvider(URI baseUri);  InstanceProfileCredentialsProvider(Provider<String> iipJsonProvider); @Override String toString(); }
InstanceProfileCredentialsProvider { @Provides Credentials get(denominator.Provider provider) { return checkValidForProvider(MapCredentials.from(parseJson(iipJsonProvider.get())), provider); } InstanceProfileCredentialsProvider();  InstanceProfileCredentialsProvider(URI baseUri);  InstanceProfileCredentialsProvider(Provider<String> iipJsonProvider); @Override String toString();  }