Example usage for com.amazonaws.services.cognitoidp.model RespondToAuthChallengeResult getSession

List of usage examples for com.amazonaws.services.cognitoidp.model RespondToAuthChallengeResult getSession

Introduction

In this page you can find the example usage for com.amazonaws.services.cognitoidp.model RespondToAuthChallengeResult getSession.

Prototype


public String getSession() 

Source Link

Document

The session which should be passed both ways in challenge-response calls to the service.

Usage

From source file:io.fineo.client.auth.cognito.CognitoUser.java

License:Open Source License

/**
 * Responds to an MFA challenge. This method creates a response to the challenge and calls the
 * internal method to respond to the authentication challenge.
 *
 * @param mfaCode                   REQUIRED: The MFA code received by the user.
 * @param challenge                 REQUIRED: Current challenge {@link RespondToAuthChallengeResult}.
 * @param callback                  REQUIRED: {@link AuthenticationHandler} callback.
 * @return {@link Runnable} for the next step in user authentication.
 *//*www . j  a va2s  .c o m*/
public Runnable respondToMfaChallenge(final String mfaCode, final RespondToAuthChallengeResult challenge,
        final AuthenticationHandler callback, final boolean runInBackground) {
    final RespondToAuthChallengeRequest challengeResponse = new RespondToAuthChallengeRequest();
    Map<String, String> mfaParameters = new HashMap<String, String>();
    mfaParameters.put("SMS_MFA_CODE", mfaCode);
    mfaParameters.put("USERNAME", usernameInternal);
    mfaParameters.put("DEVICE_KEY", deviceKey);
    mfaParameters.put("SECRET_HASH", secretHash);
    challengeResponse.setClientId(clientId);
    challengeResponse.setSession(challenge.getSession());
    challengeResponse.setChallengeName(challenge.getChallengeName());
    challengeResponse.setChallengeResponses(mfaParameters);
    return respondToChallenge(challengeResponse, callback, runInBackground);
}