Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Read the authenticationFlowType value of the configuration #2503

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
## [Release 2.25.0](https://github.com/aws-amplify/aws-sdk-android/releases/tag/release_v2.25.0)

### Features
- **aws-android-sdk-cognitoidentityprovider:** update models to latest (#2510)

### Bug Fixes
- **aws-android-sdk-lex:** prioritize custom lex signer for all regions (#2506)
- **mobileclient:** Honor auth flow setting from config (#2499)
- **aws-android-sdk-polly:** use correct SignerConfig in all regions (#2505)

[See all changes between 2.24.0 and 2.25.0](https://github.com/aws-amplify/aws-sdk-android/compare/release_v2.24.0...release_v2.25.0)

## [Release 2.24.0](https://github.com/aws-amplify/aws-sdk-android/releases/tag/release_v2.24.0)

### Features
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,13 @@ static SignInMode fromString(final String str) {
*/
boolean mIsPersistenceEnabled = true;

/**
* Flag that indicates if the SRP password verification is used in
* a custom authentication Flow. By default, this is set to false.
* If set to true custom authentication would be enabled.
*/
boolean mCustomAuthEnabled = true;

/**
* Constructor invoked by getInstance.
*
Expand Down Expand Up @@ -492,7 +499,9 @@ public void run() {
}

mIsPersistenceEnabled = true; // Default value
// Read Persistence key from the awsconfiguration.json and set the flag
mCustomAuthEnabled = false; // Default value

// Read Persistence key from the awsconfiguration.json and set the flags
// appropriately.
try {
if (awsConfiguration.optJsonObject(AUTH_KEY) != null &&
Expand All @@ -501,6 +510,14 @@ public void run() {
.optJsonObject(AUTH_KEY)
.getBoolean("Persistence");
}

if (
awsConfiguration.optJsonObject(AUTH_KEY) != null &&
awsConfiguration.optJsonObject(AUTH_KEY).has("authenticationFlowType") &&
awsConfiguration.optJsonObject(AUTH_KEY).getString("authenticationFlowType").equals("CUSTOM_AUTH")
) {
mCustomAuthEnabled = true;
}
} catch (final Exception ex) {
// If reading from awsconfiguration.json fails, invoke callback.
callback.onError(new RuntimeException("Failed to initialize AWSMobileClient; please check your awsconfiguration.json", ex));
Expand Down Expand Up @@ -790,6 +807,12 @@ public void run() {
}
}

public boolean isCustomAuthEnabled() { return mCustomAuthEnabled; }

public void setCustomAuthEnabled(boolean customAuthEnabled) {
mCustomAuthEnabled = customAuthEnabled;
}

/**
* Uses Android system commands to determine if the device is online.
* Requires ACCESS_NETWORK_STATE.
Expand Down Expand Up @@ -1246,7 +1269,7 @@ public void getAuthenticationDetails(AuthenticationContinuation authenticationCo
String authFlowType = authFlowTypeInConfig ?
awsConfiguration.optJsonObject(AUTH_KEY).getString("authenticationFlowType") :
null;
if (authFlowTypeInConfig && AUTH_TYPE_INIT_CUSTOM_AUTH.equals(authFlowType)) {
if (mCustomAuthEnabled) {
// If there's a value in the config and it's CUSTOM_AUTH, we'll
// use one of the below constructors depending on what's passed in.
if (password != null) {
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ android.enableJetifier=true

GROUP=com.amazonaws

VERSION_NAME=2.24.0
VERSION_NAME=2.25.0

POM_URL=https://github.com/aws/aws-sdk-android
POM_SCM_URL=https://github.com/aws/aws-sdk-android
Expand Down