Search in sources :

Example 6 with IdentityManager

use of com.amazonaws.mobile.auth.core.IdentityManager in project aws-sdk-android by aws-amplify.

the class OAuth2Utils method registerUserSignInProvidersWithPermissions.

/**
 * Register the SignInProvider with their permissions
 * supplied by the user.
 */
private void registerUserSignInProvidersWithPermissions() {
    Log.d(TAG, "Using the SignInProviderConfig supplied by the user.");
    final IdentityManager identityManager = IdentityManager.getDefaultIdentityManager();
    for (final SignInProviderConfig config : signInProviderConfig) {
        identityManager.addSignInProvider((Class<? extends SignInProvider>) config.getSignInProviderClass());
        if (config.getProviderPermissions() != null) {
            if (FacebookSignInProvider.class.isInstance(config.getSignInProviderClass())) {
                FacebookSignInProvider.setPermissions(config.getProviderPermissions());
            }
            if (GoogleSignInProvider.class.isInstance(config.getSignInProviderClass())) {
                GoogleSignInProvider.setPermissions(config.getProviderPermissions());
            }
        }
    }
}
Also used : IdentityManager(com.amazonaws.mobile.auth.core.IdentityManager)

Aggregations

IdentityManager (com.amazonaws.mobile.auth.core.IdentityManager)6 AmazonClientException (com.amazonaws.AmazonClientException)2 NotAuthorizedException (com.amazonaws.services.cognitoidentity.model.NotAuthorizedException)2 InvalidUserPoolConfigurationException (com.amazonaws.services.cognitoidentityprovider.model.InvalidUserPoolConfigurationException)2 JSONException (org.json.JSONException)2 Activity (android.app.Activity)1 CustomTabsCallback (androidx.browser.customtabs.CustomTabsCallback)1 ClientConfiguration (com.amazonaws.ClientConfiguration)1 AWSAbstractCognitoIdentityProvider (com.amazonaws.auth.AWSAbstractCognitoIdentityProvider)1 AnonymousAWSCredentials (com.amazonaws.auth.AnonymousAWSCredentials)1 CognitoCachingCredentialsProvider (com.amazonaws.auth.CognitoCachingCredentialsProvider)1 DefaultSignInResultHandler (com.amazonaws.mobile.auth.core.DefaultSignInResultHandler)1 IdentityProvider (com.amazonaws.mobile.auth.core.IdentityProvider)1 SignInStateChangeListener (com.amazonaws.mobile.auth.core.SignInStateChangeListener)1 InternalCallback (com.amazonaws.mobile.client.internal.InternalCallback)1 ReturningRunnable (com.amazonaws.mobile.client.internal.ReturningRunnable)1 OAuth2Client (com.amazonaws.mobile.client.internal.oauth2.OAuth2Client)1 CognitoUserPool (com.amazonaws.mobileconnectors.cognitoidentityprovider.CognitoUserPool)1 AmazonCognitoIdentityClient (com.amazonaws.services.cognitoidentity.AmazonCognitoIdentityClient)1 AmazonCognitoIdentityProvider (com.amazonaws.services.cognitoidentityprovider.AmazonCognitoIdentityProvider)1