use of com.amazonaws.services.cognitoidentity.AmazonCognitoIdentity in project aws-sdk-android by aws-amplify.
the class AWSMobileClientTest method testFederatedSignInWithDeveloperAuthenticatedIdentities.
@Ignore("Developer authentication is an undocumented edge case so ignoring this for now. Needs resource setup.")
@Test
public void testFederatedSignInWithDeveloperAuthenticatedIdentities() throws Exception {
AmazonCognitoIdentity identityClient = new AmazonCognitoIdentityClient(credentials);
identityClient.setRegion(Region.getRegion("us-west-2"));
GetOpenIdTokenForDeveloperIdentityRequest request = new GetOpenIdTokenForDeveloperIdentityRequest();
request.setIdentityPoolId(identityPoolId);
HashMap<String, String> logins = new HashMap<String, String>();
logins.put("foo.bar", "john.doe");
request.setLogins(logins);
GetOpenIdTokenForDeveloperIdentityResult response = identityClient.getOpenIdTokenForDeveloperIdentity(request);
final String identityId = response.getIdentityId();
final String token = response.getToken();
FederatedSignInOptions options = FederatedSignInOptions.builder().cognitoIdentityId(identityId).build();
UserStateDetails userStateDetails = auth.federatedSignIn(IdentityProvider.DEVELOPER.toString(), token, options);
assertEquals(SIGNED_IN, userStateDetails.getUserState());
assertNotNull("Credentials from federated sign-in should not be null", auth.getCredentials());
}
Aggregations