Skip to content
New issue

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

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

Already on GitHub? # to your account

fix ISession.CreateTime #173

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

fix ISession.CreateTime #173

wants to merge 1 commit into from

Conversation

lugehorsam
Copy link
Contributor

No description provided.

@@ -41,6 +41,7 @@ public async Task ShouldAuthenticateCustomId()
Assert.NotNull(session.UserId);
Assert.NotNull(session.Username);
Assert.False(session.IsExpired);
Assert.Equal(DateTimeOffset.UtcNow.ToUnixTimeSeconds(), session.CreateTime);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This may fail if the auth takes 1s to return, shouldn't happen but I wonder if there's a better way of testing time related assertions?

Copy link
Contributor Author

@lugehorsam lugehorsam Apr 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sesposito session.CreateTime is actually not returned by the JWT from the server (unless you understand differently?); it's actually set on the session on the client after the server returns. So the chance of the values being unequal would be approx. 1 in a billion on most devs CPUs. That being said, could take a "before authentication" timestamp and "after authentication" timestamp and just ensure that the session.CreateTime falls within the range?

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.


Luke Gehorsam seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants