Skip to content

Commit

Permalink
Merge branch 'main' into mattcreaser/api-subscription-auth
Browse files Browse the repository at this point in the history
  • Loading branch information
mattcreaser authored Jun 11, 2024
2 parents e89aec5 + 497e19a commit 96776eb
Show file tree
Hide file tree
Showing 14 changed files with 62 additions and 27 deletions.
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
## [Release 2.18.0](https://github.com/aws-amplify/amplify-android/releases/tag/release_v2.18.0)

### Features
- **all:** Update to Kotlin SDK 1.2.8 (includes OkHttp Update) ([#2813](https://github.com/aws-amplify/amplify-android/issues/2813))

### Bug Fixes
- **auth:** Fix HostedUI signout cancellation issue ([#2834](https://github.com/aws-amplify/amplify-android/issues/2834))
- **auth:** Fix parsing of REQUIRES_UPPERCASE/REQUIRES_LOWERCASE password settings in Gen1 ([#2836](https://github.com/aws-amplify/amplify-android/issues/2836))

[See all changes between 2.17.0 and 2.18.0](https://github.com/aws-amplify/amplify-android/compare/release_v2.17.0...release_v2.18.0)

## [Release 2.17.0](https://github.com/aws-amplify/amplify-android/releases/tag/release_v2.17.0)

### Features
Expand Down
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,14 +71,14 @@ dependencies section:
```groovy
dependencies {
// Only specify modules that provide functionality your app will use
implementation 'com.amplifyframework:aws-analytics-pinpoint:2.17.0'
implementation 'com.amplifyframework:aws-api:2.17.0'
implementation 'com.amplifyframework:aws-auth-cognito:2.17.0'
implementation 'com.amplifyframework:aws-datastore:2.17.0'
implementation 'com.amplifyframework:aws-predictions:2.17.0'
implementation 'com.amplifyframework:aws-storage-s3:2.17.0'
implementation 'com.amplifyframework:aws-geo-location:2.17.0'
implementation 'com.amplifyframework:aws-push-notifications-pinpoint:2.17.0'
implementation 'com.amplifyframework:aws-analytics-pinpoint:2.18.0'
implementation 'com.amplifyframework:aws-api:2.18.0'
implementation 'com.amplifyframework:aws-auth-cognito:2.18.0'
implementation 'com.amplifyframework:aws-datastore:2.18.0'
implementation 'com.amplifyframework:aws-predictions:2.18.0'
implementation 'com.amplifyframework:aws-storage-s3:2.18.0'
implementation 'com.amplifyframework:aws-geo-location:2.18.0'
implementation 'com.amplifyframework:aws-push-notifications-pinpoint:2.18.0'
}
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -202,16 +202,16 @@ data class AuthConfiguration internal constructor(
length = passwordLength,
requiresNumber = passwordRequirements.contains("REQUIRES_NUMBERS"),
requiresSpecial = passwordRequirements.contains("REQUIRES_SYMBOLS"),
requiresLower = passwordRequirements.contains("REQUIRES_LOWER"),
requiresUpper = passwordRequirements.contains("REQUIRES_UPPER")
requiresLower = passwordRequirements.contains("REQUIRES_LOWERCASE"),
requiresUpper = passwordRequirements.contains("REQUIRES_UPPERCASE")
)
}

private fun PasswordProtectionSettings.toGen1Json() = JSONObject().apply {
put("passwordPolicyMinLength", length)
val characters = JSONArray().apply {
if (requiresLower) put("REQUIRES_LOWER")
if (requiresUpper) put("REQUIRES_UPPER")
if (requiresLower) put("REQUIRES_LOWERCASE")
if (requiresUpper) put("REQUIRES_UPPERCASE")
if (requiresNumber) put("REQUIRES_NUMBERS")
if (requiresSpecial) put("REQUIRES_SYMBOLS")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1880,6 +1880,7 @@ internal class RealAWSCognitoAuthPlugin(

private fun _signOut(sendHubEvent: Boolean = true, onComplete: Consumer<AuthSignOutResult>) {
val token = StateChangeListenerToken()
var cancellationException: UserCancelledException? = null
authStateMachine.listen(
token,
{ authState ->
Expand Down Expand Up @@ -1921,6 +1922,18 @@ internal class RealAWSCognitoAuthPlugin(
)
)
}
authNState is AuthenticationState.SigningOut -> {
val state = authNState.signOutState
if (state is SignOutState.Error && state.exception is UserCancelledException) {
cancellationException = state.exception
}
}
authNState is AuthenticationState.SignedIn && cancellationException != null -> {
authStateMachine.cancel(token)
cancellationException?.let {
onComplete.accept(AWSCognitoAuthSignOutResult.FailedSignOut(it))
}
}
else -> {
// No - op
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

package com.amplifyframework.statemachine.codegen.states

import com.amplifyframework.auth.cognito.exceptions.service.UserCancelledException
import com.amplifyframework.auth.cognito.isAuthEvent
import com.amplifyframework.auth.cognito.isSignOutEvent
import com.amplifyframework.statemachine.State
Expand Down Expand Up @@ -86,7 +87,15 @@ internal sealed class SignOutState : State {
}
is SignOutEvent.EventType.UserCancelled -> {
val action = signOutActions.userCancelledAction(signOutEvent)
StateResolution(Error(Exception("User Cancelled")), listOf(action))
StateResolution(
Error(
UserCancelledException(
"The user cancelled the sign-out attempt, so it did not complete.",
"To recover: catch this error, and attempt the sign out again."
)
),
listOf(action)
)
}
else -> defaultResolution
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ class AuthConfigurationTest {
],
"passwordProtectionSettings": {
"passwordPolicyMinLength": 10,
"passwordPolicyCharacters": ["REQUIRES_NUMBERS", "REQUIRES_LOWER"]
"passwordPolicyCharacters": ["REQUIRES_NUMBERS", "REQUIRES_LOWERCASE"]
},
"mfaConfiguration": "OFF",
"mfaTypes": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@
"recoverySuggestion": "Check whether the given values are correct and the user is authorized to perform the operation.",
"cause": {
"errorType": "NotAuthorizedException",
"errorMessage": null
"errorMessage": "Error type: Client, Protocol response: (empty response)"
}
}
}
]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"recoverySuggestion": "See attached exception for more details. RevokeToken can be retried using the CognitoIdentityProviderClient accessible from the escape hatch.",
"cause": {
"errorType": "NotAuthorizedException",
"errorMessage": null
"errorMessage": "Error type: Client, Protocol response: (empty response)"
}
},
"refreshToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJ1c2VySWQiLCJ1c2VybmFtZSI6InVzZXJuYW1lIiwiZXhwIjoxNTE2MjM5MDIyLCJvcmlnaW5fanRpIjoib3JpZ2luX2p0aSJ9.Xqa-vjJe5wwwsqeRAdHf8kTBn_rYSkDn2lB7xj9Z1xU"
Expand All @@ -54,4 +54,4 @@
}
}
]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"recoverySuggestion": "See attached exception for more details. GlobalSignOut can be retried using the CognitoIdentityProviderClient accessible from the escape hatch.",
"cause": {
"errorType": "NotAuthorizedException",
"errorMessage": null
"errorMessage": "Error type: Client, Protocol response: (empty response)"
}
}
},
Expand All @@ -64,4 +64,4 @@
}
}
]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"recoverySuggestion": "See attached exception for more details. RevokeToken can be retried using the CognitoIdentityProviderClient accessible from the escape hatch.",
"cause": {
"errorType": "NotAuthorizedException",
"errorMessage": null
"errorMessage": "Error type: Client, Protocol response: (empty response)"
}
},
"refreshToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJ1c2VySWQiLCJ1c2VybmFtZSI6InVzZXJuYW1lIiwiZXhwIjoxNTE2MjM5MDIyLCJvcmlnaW5fanRpIjoib3JpZ2luX2p0aSJ9.Xqa-vjJe5wwwsqeRAdHf8kTBn_rYSkDn2lB7xj9Z1xU"
Expand All @@ -47,4 +47,4 @@
}
}
]
}
}
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ org.gradle.jvmargs=-Xmx4g
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
org.gradle.parallel=true

VERSION_NAME=2.17.0
VERSION_NAME=2.18.0

POM_GROUP=com.amplifyframework
POM_URL=https://github.com/aws-amplify/amplify-android
Expand Down
4 changes: 2 additions & 2 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ androidx-test-junit = "1.1.2"
androidx-test-orchestrator = "1.4.2"
androidx-test-runner = "1.3.0"
androidx-workmanager = "2.7.1"
aws-kotlin = "1.0.44" # ensure proper aws-smithy version also set
aws-kotlin = "1.2.8" # ensure proper aws-smithy version also set
aws-sdk = "2.62.2"
aws-smithy = "1.0.11" # ensure proper aws-kotlin version also set
aws-smithy = "1.2.2" # ensure proper aws-kotlin version also set
binary-compatibility-validator = "0.14.0"
coroutines = "1.7.3"
desugar = "1.2.0"
Expand Down
2 changes: 1 addition & 1 deletion rxbindings/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ library. In your module's `build.gradle`:
```gradle
dependencies {
// Add this line.
implementation 'com.amplifyframework:rxbindings:2.17.0'
implementation 'com.amplifyframework:rxbindings:2.18.0'
}
```

Expand Down
4 changes: 3 additions & 1 deletion scripts/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,8 @@ GEM
trailblazer-option (>= 0.1.1, < 0.2.0)
uber (< 0.2.0)
retriable (3.1.2)
rexml (3.2.5)
rexml (3.2.8)
strscan (>= 3.0.9)
rouge (2.0.7)
ruby2_keywords (0.0.4)
rubyzip (2.3.2)
Expand All @@ -181,6 +182,7 @@ GEM
simctl (1.6.8)
CFPropertyList
naturally
strscan (3.1.0)
terminal-notifier (2.0.0)
terminal-table (1.8.0)
unicode-display_width (~> 1.1, >= 1.1.1)
Expand Down

0 comments on commit 96776eb

Please sign in to comment.