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

Some way to add authentication for all routes with exclusion. #86

Open
aderbas opened this issue May 13, 2024 · 1 comment
Open

Some way to add authentication for all routes with exclusion. #86

aderbas opened this issue May 13, 2024 · 1 comment

Comments

@aderbas
Copy link

aderbas commented May 13, 2024

(question) Isn't there some way for the documentation generated to understand that all routes, except for some informed ones, are protected by authentication? For example, in my application I am using a middleware.

app.wsgi_app = AuthMiddleware(app.wsgi_app)

Therefore, the documentation does not understand that the routes are protected by authentication. I would have to put the @authenticate() annotation on all routes. Isn't there any way to recognize the middleware?

@miguelgrinberg
Copy link
Owner

miguelgrinberg commented May 13, 2024

No, there is currently no way to add authentication to all routes. Normally this isn't what you want, there is always routes that are exempt, so if this feature was added you would need to have an exempt list.

Another option you may consider is creating an "authenticated_route" decorator that combines Flask's route with APIFairy's authenticate.

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

No branches or pull requests

2 participants