Support for @PreAuthorize spring-security annotation
See original GitHub issueHello,
I’m using Springfox 2.6.1 in JHipster apps and this is a feature request.
It would be nice if Springfox could support spring-security annotations, especially @PreAuthorize
.
It could be:
- Exposing in the swagger UI the requirements to access a resource or its methods
- Expose in the swagger spec only the resources and methods allowed for current user
Thanks
Issue Analytics
- State:
- Created 7 years ago
- Reactions:31
- Comments:15 (2 by maintainers)
Top Results From Across the Web
Spring Method Security with PreAuthorize - Okta Developer
This tutorial will explore two ways to configure authentication and authorization in Spring Boot using Spring Security.
Read more >Introduction to Spring Method Security - Baeldung
The @PreAuthorize annotation checks the given expression before entering the method, whereas the @PostAuthorize annotation verifies it after the ...
Read more >Spring Security @PreAuthorize Annotation Example
In this Spring Security tutorial, you will learn how to use the @PreAuthorize annotation to secure method invocation.
Read more >Spring Method Security with @PreAuthorize and @Secured
In this Spring security tutorial, learn to apply method security using annotations such as @PreAuthorize and @Secured .
Read more >Method Security - Spring
Spring Security's native annotation support defines a set of attributes for the method. These are passed to the AccessDecisionManager for it to make...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Adapting the antMatcher link posted by @wojciech-soltys, the following works for my purposes (but by NO MEANS is exhaustive for all spring security annotations)
Yes that’s correct, it seems to me that currently the securityContexts and securitySchemes mainly deal with authentication and I would like to be able to document also authorizations.
The other point is that the swagger spec generated dynamically does not take into account the authorizations of the current user and so is exposing the complete API even though the current user is not authorized to use it. To me that’s a reason why some people are reluctant to enable swagger in production.
So maybe this should be split in 2 requests.