Is my code sane? Automatically require login for all routes
Closed this issue ยท 1 comments
Krogsager commented
I have a blueprint with 6 routes, and I want all to require a login. I am paranoid about forgetting to add the decorator @auth.oidc_auth(PROVIDER_NAME)
to a route, and allowing unauthorized users in.
I wrote the following:
@main_bp.before_request
@auth.oidc_auth(PROVIDER_NAME1)
def require_login():
pass
Thank you for building and supporting this library <3
zamzterz commented
Yes, as far as I can think that's a smart approach to always enforcing login! ๐
(Though I haven't actually tested it myself, but assuming you have and it works as expected.)
And thanks for your kind words ๐