Add "ignore_session" option to configuration #201
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
ignore_session
option allows to authenticate a user with strategies even if there is a user in the session:I have a controller where I want to authenticate a user only by one specific strategy.
So I write something like this:
It works fine until a user with a cookie sends a request to this controller. In this case, my custom strategy will be ignored and the user will be found in cookies.
I know I can achieve what I want by changing the scope. But it doesn't give a 100% guarantee. If somehow the cookie will be set for
user
scope - the problem will repeat.ignore_session
option gives a 100% guarantee that my strategy will be used.It can be helpful for other people I believe. Like it can be used for API controllers where you need to authenticate a user only for some kind of token.
Currently, a user with a cookie can send requests to such controller with different tokens and these tokens will be ignored.
What do you think?