List of usage examples for com.amazonaws.services.cognitoidp.model RespondToAuthChallengeRequest getChallengeResponses
public java.util.Map<String, String> getChallengeResponses()
The challenge responses.
From source file:io.fineo.client.auth.cognito.CognitoUser.java
License:Open Source License
/** * This method sends the challenge response to the Cognito IDP service. The call to the Cognito IDP * service returns a new challenge and a different method is called to process the challenge. * Restarts authentication if the service cannot find a device-key. * * @param challengeResponse REQUIRED: {@link RespondToAuthChallengeRequest} contains * response for the current challenge. * @param callback REQUIRED: {@link AuthenticationHandler} callback. * @param runInBackground REQUIRED: Boolean to indicate the current threading. * @return {@link Runnable} for the next step in user authentication. */// www . jav a2s . c o m public Runnable respondToChallenge(final RespondToAuthChallengeRequest challengeResponse, final AuthenticationHandler callback, final boolean runInBackground) { try { if (challengeResponse != null && challengeResponse.getChallengeResponses() != null) { Map<String, String> challengeResponses = challengeResponse.getChallengeResponses(); challengeResponses.put("DEVICE_KEY", deviceKey); challengeResponse.setChallengeResponses(challengeResponses); } RespondToAuthChallengeResult challenge = cognitoIdentityProviderClient .respondToAuthChallenge(challengeResponse); return handleChallenge(challenge, callback, runInBackground); } catch (final ResourceNotFoundException rna) { final CognitoUser cognitoUser = this; if (rna.getMessage().contains("Device")) { return clearCache(cognitoUser, runInBackground, callback); } else { return new Runnable() { @Override public void run() { callback.onFailure(rna); } }; } } catch (final Exception e) { return new Runnable() { @Override public void run() { callback.onFailure(e); } }; } }