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 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?

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

Successfully merging this pull request may close these issues.

None yet

2 participants