Skip to content

Commit d6eb96c

Browse files
minbirohandubal
authored andcommitted
Fix isAuthenticated in CognitoAuth caused by scopes unmarshalling (#874)
* [CognitoAuth] Fix string to set logic that caused isAuthenticated to return false #809 * Update CHANGELOG.md
1 parent 8b2503c commit d6eb96c

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

.idea/modules.xml

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515
* **AWS Mobile Client**
1616
* Fixed a bug that caused repetitive sign-in using the drop-in UI to the same provider to not federate the correct credentials. See [issue #809](https://github.com/aws-amplify/aws-sdk-android/issues/809)
1717

18+
* **Amazon Cognito Auth**
19+
* Fixed a bug that caused `isAuthenticated()` to return false after sign-in when no scopes were requested. See [issue #813](https://github.com/aws-amplify/aws-sdk-android/issues/813)
20+
1821
* **Amazon Pinpoint**
1922
* Fix a bug where the image that is part of a push notification is persisted in the subsequent notifications.
2023
* Fix a bug where the events recorded and stored in the device will not be deleted when the network is not available. See [issue #773](https://github.com/aws-amplify/aws-sdk-android/issues/773). With this change, the events will be kept in the local database when there is a retryable error or device is offline. For all other exceptions during `submitEvents`, the exception is logged and the events will be removed from the local database.

aws-android-sdk-cognitoauth/src/main/java/com/amazonaws/mobileconnectors/cognitoauth/util/LocalDataManager.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
import com.amazonaws.mobileconnectors.cognitoauth.tokens.IdToken;
2727
import com.amazonaws.mobileconnectors.cognitoauth.tokens.RefreshToken;
2828
import com.amazonaws.mobileconnectors.cognitoauth.AuthUserSession;
29+
import com.amazonaws.util.StringUtils;
2930

3031
import java.security.InvalidParameterException;
3132
import java.util.Arrays;
@@ -504,7 +505,12 @@ static String setToString(Set<String> stringSet) {
504505
}
505506

506507
static Set<String> setFromString(String str) {
508+
final HashSet<String> stringSet = new HashSet<>();
509+
if (StringUtils.isBlank(str)) {
510+
return stringSet;
511+
}
507512
String[] stringArray = str.split(",");
508-
return new HashSet<String>(Arrays.asList(stringArray));
513+
stringSet.addAll(Arrays.asList(stringArray));
514+
return stringSet;
509515
}
510516
}

0 commit comments

Comments
 (0)