Search in sources :

Example 1 with BasicCognitoUserPoolsAuthProvider

use of com.amazonaws.mobileconnectors.appsync.sigv4.BasicCognitoUserPoolsAuthProvider in project aws-mobile-appsync-sdk-android by awslabs.

the class AppSyncClientUnitTest method testConfigMismatch_AmazonCognitoUserPools.

@Test(expected = RuntimeException.class)
public void testConfigMismatch_AmazonCognitoUserPools() {
    awsConfiguration.setConfiguration("ApiKey");
    APIKeyAuthProvider apiKeyAuthProvider = new BasicAPIKeyAuthProvider(awsConfiguration);
    awsConfiguration.setConfiguration("AmazonCognitoUserPools");
    CognitoUserPool cognitoUserPool = new CognitoUserPool(shadowContext, awsConfiguration);
    BasicCognitoUserPoolsAuthProvider basicCognitoUserPoolsAuthProvider = new BasicCognitoUserPoolsAuthProvider(cognitoUserPool);
    final AWSAppSyncClient awsAppSyncClient = AWSAppSyncClient.builder().context(shadowContext).awsConfiguration(awsConfiguration).apiKey(apiKeyAuthProvider).build();
}
Also used : CognitoUserPool(com.amazonaws.mobileconnectors.cognitoidentityprovider.CognitoUserPool) BasicCognitoUserPoolsAuthProvider(com.amazonaws.mobileconnectors.appsync.sigv4.BasicCognitoUserPoolsAuthProvider) APIKeyAuthProvider(com.amazonaws.mobileconnectors.appsync.sigv4.APIKeyAuthProvider) BasicAPIKeyAuthProvider(com.amazonaws.mobileconnectors.appsync.sigv4.BasicAPIKeyAuthProvider) BasicAPIKeyAuthProvider(com.amazonaws.mobileconnectors.appsync.sigv4.BasicAPIKeyAuthProvider) Test(org.junit.Test)

Example 2 with BasicCognitoUserPoolsAuthProvider

use of com.amazonaws.mobileconnectors.appsync.sigv4.BasicCognitoUserPoolsAuthProvider in project aws-mobile-appsync-sdk-android by awslabs.

the class AppSyncClientUnitTest method testAmazonCognitoUserPoolsAuthProvider.

@Test
public void testAmazonCognitoUserPoolsAuthProvider() {
    awsConfiguration.setConfiguration("AmazonCognitoUserPools");
    CognitoUserPool cognitoUserPool = new CognitoUserPool(shadowContext, awsConfiguration);
    BasicCognitoUserPoolsAuthProvider basicCognitoUserPoolsAuthProvider = new BasicCognitoUserPoolsAuthProvider(cognitoUserPool);
    final AWSAppSyncClient awsAppSyncClient = AWSAppSyncClient.builder().context(shadowContext).awsConfiguration(awsConfiguration).cognitoUserPoolsAuthProvider(basicCognitoUserPoolsAuthProvider).build();
    assertNotNull(awsAppSyncClient);
}
Also used : CognitoUserPool(com.amazonaws.mobileconnectors.cognitoidentityprovider.CognitoUserPool) BasicCognitoUserPoolsAuthProvider(com.amazonaws.mobileconnectors.appsync.sigv4.BasicCognitoUserPoolsAuthProvider) Test(org.junit.Test)

Example 3 with BasicCognitoUserPoolsAuthProvider

use of com.amazonaws.mobileconnectors.appsync.sigv4.BasicCognitoUserPoolsAuthProvider in project aws-mobile-appsync-sdk-android by awslabs.

the class AppSyncClientUnitTest method testMultipleAuth.

@Test(expected = RuntimeException.class)
public void testMultipleAuth() {
    awsConfiguration.setConfiguration("ApiKey");
    APIKeyAuthProvider apiKeyAuthProvider = new BasicAPIKeyAuthProvider(awsConfiguration);
    awsConfiguration.setConfiguration("AmazonCognitoUserPools");
    CognitoUserPool cognitoUserPool = new CognitoUserPool(shadowContext, awsConfiguration);
    BasicCognitoUserPoolsAuthProvider basicCognitoUserPoolsAuthProvider = new BasicCognitoUserPoolsAuthProvider(cognitoUserPool);
    final AWSAppSyncClient awsAppSyncClient = AWSAppSyncClient.builder().context(shadowContext).awsConfiguration(awsConfiguration).apiKey(apiKeyAuthProvider).cognitoUserPoolsAuthProvider(basicCognitoUserPoolsAuthProvider).build();
}
Also used : CognitoUserPool(com.amazonaws.mobileconnectors.cognitoidentityprovider.CognitoUserPool) BasicCognitoUserPoolsAuthProvider(com.amazonaws.mobileconnectors.appsync.sigv4.BasicCognitoUserPoolsAuthProvider) APIKeyAuthProvider(com.amazonaws.mobileconnectors.appsync.sigv4.APIKeyAuthProvider) BasicAPIKeyAuthProvider(com.amazonaws.mobileconnectors.appsync.sigv4.BasicAPIKeyAuthProvider) BasicAPIKeyAuthProvider(com.amazonaws.mobileconnectors.appsync.sigv4.BasicAPIKeyAuthProvider) Test(org.junit.Test)

Aggregations

BasicCognitoUserPoolsAuthProvider (com.amazonaws.mobileconnectors.appsync.sigv4.BasicCognitoUserPoolsAuthProvider)3 CognitoUserPool (com.amazonaws.mobileconnectors.cognitoidentityprovider.CognitoUserPool)3 Test (org.junit.Test)3 APIKeyAuthProvider (com.amazonaws.mobileconnectors.appsync.sigv4.APIKeyAuthProvider)2 BasicAPIKeyAuthProvider (com.amazonaws.mobileconnectors.appsync.sigv4.BasicAPIKeyAuthProvider)2