All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.amazonaws.mobileconnectors.cognitoidentityprovider.handlers.AuthenticationHandler Maven / Gradle / Ivy

Go to download

The AWS Android SDK for Amazon Cognito Identity Provider module holds the client classes that are used for communicating with Amazon Cognito Identity Provider Service

There is a newer version: 2.79.0
Show newest version
/*
 * Copyright 2013-2016 Amazon.com,
 * Inc. or its affiliates. All Rights Reserved.
 *
 * Licensed under the Amazon Software License (the "License").
 * You may not use this file except in compliance with the
 * License. A copy of the License is located at
 *
 *     http://aws.amazon.com/asl/
 *
 * or in the "license" file accompanying this file. This file is
 * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
 * CONDITIONS OF ANY KIND, express or implied. See the License
 * for the specific language governing permissions and
 * limitations under the License.
 */

package com.amazonaws.mobileconnectors.cognitoidentityprovider.handlers;

import com.amazonaws.mobileconnectors.cognitoidentityprovider.CognitoUserSession;
import com.amazonaws.mobileconnectors.cognitoidentityprovider.continuations.AuthenticationContinuation;
import com.amazonaws.mobileconnectors.cognitoidentityprovider.continuations.MultiFactorAuthenticationContinuation;

public interface AuthenticationHandler {

    /**
     * This method is called to deliver valid tokens, when valid tokens were locally
     * available (cached) or after successful completion of the authentication process.
     *
     * @param userSession   Contains valid user tokens
     */
    public void onSuccess(CognitoUserSession userSession);

    /**
     * Call out to the dev to get the credentials for a user
     * @param authenticationContinuation is a {@link AuthenticationContinuation} object that should
     *                                   be used to continue with the authentication process when
     *                                   the users' authentication details are available.
     * @param UserId                     Is the user-ID (username  or alias) used in authentication.
     *                                   This will be null if the user ID is not available.
     */
    public void getAuthenticationDetails(AuthenticationContinuation authenticationContinuation, String UserId);

    /**
     * Call out to the dev to send MFA code,
     * MFA code would have been sent via the deliveryMethod before this is invoked.
     * This callback can be invoked in two scenarios -
     *  1)  MFA verification is required and only one possible MFA delivery medium is
     *      available.
     *  2)  MFA verification is required and a MFA delivery medium was successfully set.
     *  3)  An MFA code sent earlier was incorrect and at-least one more attempt to send
     *      MFA code is available.
     *
     * @param continuation medium through which the MFA will be delivered
     */
    public void getMFACode(MultiFactorAuthenticationContinuation continuation);

    /**
     * This method is called when a fatal exception was encountered during
     * authentication. The current authentication process continue because of the error
     * , hence a continuation is not available. Probe {@code exception} for details.
     *
     * @param exception is this Exception leading to authentication failure
     * @return Should authentication flow continue
     */
    public void onFailure(Exception exception);
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy