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

Support multiple anonymous sessions #5693

Merged
merged 13 commits into from
Aug 3, 2022

Conversation

nicola-cab
Copy link
Member

What, How & Why?

Allow multiple anonymous sessions.
Fixes: #4607

@cla-bot cla-bot bot added the cla: yes label Jul 29, 2022
@nicola-cab nicola-cab marked this pull request as draft July 29, 2022 14:23
Copy link
Member

@nirinchev nirinchev left a comment

Choose a reason for hiding this comment

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

This would be a breaking change and not what #4607 is asking for. What I'm suggesting there is that we add a parameter to the anonymous credentials that would indicate whether to reuse or not reuse existing anonymous users. The default value should be true to make sure that existing applications that authenticate anonymous users continue behaving the same way. If the user opts out of reusing an existing user, then we should authenticate a new user and return that.

@nicola-cab
Copy link
Member Author

This would be a breaking change and not what #4607 is asking for. What I'm suggesting there is that we add a parameter to the anonymous credentials that would indicate whether to reuse or not reuse existing anonymous users. The default value should be true to make sure that existing applications that authenticate anonymous users continue behaving the same way. If the user opts out of reusing an existing user, then we should authenticate a new user and return that.

OK, my change was too extreme, I redesign the code as per your suggestion.

@tgoyne
Copy link
Member

tgoyne commented Jul 29, 2022

operator= and the copy constructor also need to copy m_reuse_anonymous_credentials.

It might also make sense to instead have reused and unique anonymous users instead be different values in the credentials provider enum rather than having a bool field which is only applicable to one of the credential types.

@nicola-cab nicola-cab marked this pull request as ready for review July 29, 2022 19:09
Copy link
Member

@nirinchev nirinchev left a comment

Choose a reason for hiding this comment

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

Looks fine to me, though it'd be a good idea to add some tests to verify that it works as intended.

@nicola-cab
Copy link
Member Author

Looks fine to me, though it'd be a good idea to add some tests to verify that it works as intended.

Done, please approve, and I will merge the PR once CI has run successfully.

@nicola-cab nicola-cab changed the title Remove check for single anonymous session Support multiple anonymous sessions Aug 2, 2022
Copy link
Member

@nirinchev nirinchev left a comment

Choose a reason for hiding this comment

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

It seems fine to me, but I strongly suggest you get a review from someone on the Core team.

@nicola-cab
Copy link
Member Author

@jedelbo @tgoyne can you please have a look as well?

auto user2 = log_in(app, AppCredentials::anonymous(false));
CHECK(user1 != user2);

App::clear_cached_apps();
Copy link
Member

Choose a reason for hiding this comment

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

TestSyncManager takes care of this.

Copy link
Member Author

Choose a reason for hiding this comment

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

OK, let me remove the line.

@nicola-cab nicola-cab merged commit 4fe39c4 into master Aug 3, 2022
@nicola-cab nicola-cab deleted the nc/allow_multiple_anonymous_sessions branch August 3, 2022 09:26
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 22, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow anonymous users to be logged in without reusing existing ones
3 participants