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

Authenticate user only when needed #155

Open
marein opened this issue Oct 20, 2022 · 0 comments
Open

Authenticate user only when needed #155

marein opened this issue Oct 20, 2022 · 0 comments

Comments

@marein
Copy link
Owner

marein commented Oct 20, 2022

Currently, anonymous users are authenticated with each initial request. A better idea would be to authenticate an anonymous user only when needed, for example:

return !$request->isMethodSafe() && $this->tokenStorage->getToken() === null;

instead of

$this->tokenStorage->getToken() === null;

in ArrivalAuthenticator (former AssignUserIdOnKernelRequest). With this logic, an arrival would only happen with write http requests. The frontend has to be adapted for this, because the information that the user is authenticated is only displayed after a refresh. This would be possible by adding a response header or having the frontend actually make a request for authentication, e.g. to /arrive, before the first write request. An additional advantage would be cachability and that no users are created when bots crawl the page.

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

No branches or pull requests

1 participant