Skip to content

Commit bb0af62

Browse files
authored
Revert "fix: honor authenticationFlowType from config (#2377)" (#2399)
This reverts commit 73bb3e4.
1 parent 34ffd7a commit bb0af62

File tree

1 file changed

+7
-20
lines changed

1 file changed

+7
-20
lines changed

aws-android-sdk-mobile-client/src/main/java/com/amazonaws/mobile/client/AWSMobileClient.java

Lines changed: 7 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1206,33 +1206,20 @@ public void onSuccess(CognitoUserSession userSession, CognitoDevice newDevice) {
12061206
@Override
12071207
public void getAuthenticationDetails(AuthenticationContinuation authenticationContinuation, String userId) {
12081208
Log.d(TAG, "Sending password.");
1209-
final HashMap<String, String> authParameters = new HashMap<>();
1210-
// Check if the auth flow type setting is in the configuration.
1211-
boolean authFlowTypeInConfig =
1212-
awsConfiguration.optJsonObject(AUTH_KEY) != null &&
1213-
awsConfiguration.optJsonObject(AUTH_KEY).has("authenticationFlowType");
1214-
12151209
try {
1216-
String authFlowType = authFlowTypeInConfig ?
1217-
awsConfiguration.optJsonObject(AUTH_KEY).getString("authenticationFlowType") :
1218-
null;
1219-
// If there's a value in the config and it's CUSTOM_AUTH
1220-
if (authFlowTypeInConfig && "CUSTOM_AUTH".equals(authFlowType)) {
1210+
if (
1211+
awsConfiguration.optJsonObject(AUTH_KEY) != null &&
1212+
awsConfiguration.optJsonObject(AUTH_KEY).has("authenticationFlowType") &&
1213+
awsConfiguration.optJsonObject(AUTH_KEY).getString("authenticationFlowType").equals("CUSTOM_AUTH")
1214+
) {
1215+
final HashMap<String, String> authParameters = new HashMap<String, String>();
12211216
if (password != null) {
12221217
authenticationContinuation.setAuthenticationDetails(new AuthenticationDetails(username, password, authParameters, validationData));
12231218
} else {
12241219
authenticationContinuation.setAuthenticationDetails(new AuthenticationDetails(username, authParameters, validationData));
12251220
}
12261221
} else {
1227-
// Otherwise, create the AuthenticationDetails instance using the constructor below
1228-
// which will default the auth flow to CHLG_TYPE_USER_PASSWORD_VERIFIER
1229-
AuthenticationDetails authenticationDetails = new AuthenticationDetails(username, password, validationData);
1230-
if (authFlowTypeInConfig) {
1231-
// If there's an auth flow type value in the config, use that value instead.
1232-
// The field names are very misleading.
1233-
authenticationDetails.setAuthenticationType(awsConfiguration.optJsonObject(AUTH_KEY).getString("authenticationFlowType"));
1234-
}
1235-
authenticationContinuation.setAuthenticationDetails(authenticationDetails);
1222+
authenticationContinuation.setAuthenticationDetails(new AuthenticationDetails(username, password, validationData));
12361223
}
12371224
} catch (JSONException e) {
12381225
e.printStackTrace();

0 commit comments

Comments
 (0)