Search in sources :

Example 1 with APIKeyAuthProvider

use of com.amazonaws.mobileconnectors.appsync.sigv4.APIKeyAuthProvider 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 APIKeyAuthProvider

use of com.amazonaws.mobileconnectors.appsync.sigv4.APIKeyAuthProvider 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

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