How to disable all auth_required decorators? #534
-
Hello all, Motive: |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Simple answer is no - there is no simple config that will disable the authn decorators. Not having any identifiable caller seems risky - one quick though I had was to define your own LoginManager (subclass the one in Flask-Login) and provide a user_loader that just sets a pre-configured user. Then everything should just work as long as you are just using sessions for authn (not Basic or tokens). |
Beta Was this translation helpful? Give feedback.
-
We had a similar issue: we wanted automated tests to call our auth-protected api routes as if a test user was logged in (without going through actual login every time first). The way we've hacked around it is by manually setting
|
Beta Was this translation helpful? Give feedback.
Simple answer is no - there is no simple config that will disable the authn decorators.
Note that without any authentication there won't be a 'user' defined so none of the flask-security endpoints will work - so you should probably make sure FS doesn't register its blueprints.
Not having any identifiable caller seems risky - one quick though I had was to define your own LoginManager (subclass the one in Flask-Login) and provide a user_loader that just sets a pre-configured user. Then everything should just work as long as you are just using sessions for authn (not Basic or tokens).