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

Fix timezone issue in Android Credentials Manager handler #162

Merged
merged 1 commit into from
Sep 14, 2022

Conversation

Widcket
Copy link
Contributor

@Widcket Widcket commented Sep 14, 2022

  • All new/changed/fixed functionality is covered by tests (or N/A)
  • I have added documentation for all new/changed functionality (or N/A)

📋 Changes

The Android SaveCredentialsRequestHandler receives an expiresAt UTC string date from the Dart layer. This date string should be parsed as UTC, but instead it gets parsed using the default timezone. Thus, the default timezone's offset gets added to the date, resulting in an incorrect Credentials.expiresAt value.

This happens because no timezone was specified for the SimpleDateFormat parser, and as such TimeZone.getDefault() gets used by default.

This PR ensures the SaveCredentialsRequestHandler parses this date as UTC, by setting "UTC" as the parser's timezone.

Before

Screen Shot 2022-09-13 at 22 48 58

After

Screen Shot 2022-09-13 at 22 52 20

📎 References

Fixes #160

🎯 Testing

Asserts were added to an existing unit test.

@Widcket Widcket added the review:tiny Tiny review label Sep 14, 2022
@Widcket Widcket requested a review from a team as a code owner September 14, 2022 02:50
@codecov
Copy link

codecov bot commented Sep 14, 2022

Codecov Report

Base: 98.69% // Head: 98.69% // Increases project coverage by +0.00% 🎉

Coverage data is based on head (17a8361) compared to base (e047bca).
Patch coverage: 100.00% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff            @@
##               main     #162   +/-   ##
=========================================
  Coverage     98.69%   98.69%           
  Complexity       75       75           
=========================================
  Files            75       75           
  Lines          1377     1378    +1     
  Branches        296      296           
=========================================
+ Hits           1359     1360    +1     
  Misses            6        6           
  Partials         12       12           
Flag Coverage Δ
auth0_flutter 100.00% <ø> (ø)
auth0_flutter_android 96.53% <100.00%> (+<0.01%) ⬆️
auth0_flutter_ios 100.00% <ø> (ø)
auth0_flutter_platform_interface 99.25% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...edentials_manager/SaveCredentialsRequestHandler.kt 100.00% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@Widcket Widcket merged commit dad9359 into main Sep 14, 2022
@Widcket Widcket deleted the fix/android-cm-timezone branch September 14, 2022 11:02
@stevehobbsdev stevehobbsdev mentioned this pull request Sep 14, 2022
@aprzedecki aprzedecki mentioned this pull request Oct 2, 2023
6 tasks
@poovamraj poovamraj mentioned this pull request Oct 12, 2023
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
review:tiny Tiny review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

credentialsManager alters access token expiry upon storing credentials
2 participants