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

disableSetTokenCookie && getUser #778

Merged
merged 5 commits into from
Feb 12, 2021

Conversation

Kaczkazniszczenia
Copy link
Contributor

This PR is related to issue: Load balancer and cookie proposal #776

A minimalist approach that allows you to write your own association of the user with a cookie. Two hooks added:

  • disableSetTokenCookie {Boolean} [Client] - If true it will disable code responsible for setting 'x_mtok' cookie.

  • getUser {Function} [Server] - defining this function causes the replacement of the algorithm to recognize the user on the basis of 'http request'

Answers to 'yet' not asked questions:

  • Why do I need 'getUser' if I already have 'protected'.

Using 'protected' to change the user recognition method does not allow you to skip searching for the user using the 'x_mtok' cookie (which may not even exist), but only overwrite the failed attempt. Besides, with the current setting the 'protected' method has too much responsibility, adding a second method that better suits some subset of responsibilities will make the code more readable.

  • Do I really need a 'disableSetTokenCookie'?

Even if someone uses the default cookie 'x_mtok', it is set and refreshed for each collection separately. I haven't investigated whether these extra calculations are noticeable for cpu, however, regardless of the results, I think it would be a good practice to disable cookies for all but one collection.

Allow to disable cookie setter.
alow to redefine how collection will recognize user.
callmemb and others added 2 commits November 28, 2020 19:57
@dr-dimitru dr-dimitru merged commit b66659b into veliovgroup:dev Feb 12, 2021
dr-dimitru added a commit that referenced this pull request Mar 1, 2021
- ✨ `config.disableSetTokenCookie` see #776 and #778 for details
- 👨‍💻 Abort http-fetch requests when calling `.abort()`;
- 👨‍💻 Make sure no other/delayed requests/responses executed;
@dr-dimitru dr-dimitru mentioned this pull request Mar 1, 2021
dr-dimitru added a commit that referenced this pull request Mar 1, 2021
v2.0.1

__New:__
- ✨ `config.disableSetTokenCookie` see #776 and #778 for details, thanks to @Kaczkazniszczenia

__Changed:__
- 👨‍💻 Abort http-fetch requests when calling `.abort()`;
- 👨‍💻 Make sure no other/delayed requests/responses executed;
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.

3 participants