Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The UTC time offset is currently converted straight to a DateTime in the computer's local timezone. It is then passed into the CognitoUserSession constructor, where it is converted to a universal time.
If you're in a timezone +'ve of UTC this means that IsValid on the CognitoUserSession will always return false, which breaks a number of other methods in the User Manager (anything that checks for authentication).
Issue #, if available:
On Line 168 of CognitoUserManager this line of code exists:
user.SessionTokens = new CognitoUserSession(idToken, accessToken, refreshToken, result.Properties.IssuedUtc.Value.DateTime, result.Properties.ExpiresUtc.Value.DateTime);
This writes the UTC time into a local time, and then the CognitoUserSession constructer makes that local time a UTC time. This means that the time written to the CognitoUserSession for token expiry is incorrect, and if you're in a positive timezone, it means IsValid won't return true.
Description of changes:
Fixed this time conversion bug by changing
.Value.DateTime
to.Value.UtcDateTime
.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.