Adding /login endpoint to documentation
See original GitHub issueHi.
I added Swagger and it generated my docs correctly. But I have /login endpoint which I want to document as well. It is the Spring Security default endpoint that means I don’t have any controller in my package for it.
I am looking for solution for 2 days without success. I actually find this http://springfox.github.io/springfox/docs/current/#example-apilistingscannerplugin but it doesn’t work as expected.
Problems:
-
How to replace “default” as controller name to something else?
-
How to filter out error controller. Before implementing above plugin, following solution worked well.
new Docket()........paths(paths())
...
private Predicate<String> paths() {
return or(
regex("/login.*"),
regex("/product.*"),
regex("/group.*"),
regex("/order.*"),
// regex("/cart.*"),
// regex("/springsRestController.*"),
regex("/cart.*"));
}
Check attached image and you will understand my problems.
Any hint, suggestion or solution?
Thanks for help.
Issue Analytics
- State:
- Created 6 years ago
- Comments:15 (4 by maintainers)
Top Results From Across the Web
Login endpoint - Amazon Cognito - AWS Documentation
The /login endpoint signs the user in. It loads the login page and presents the authentication options configured for the client to the...
Read more >SpringFox and Swagger UI - How to document the /login ...
I use Spring Security and the /login endpoint accepts: email and password for user to be able to login. How can I add...
Read more >Add Login Using the Authorization Code Flow - Auth0
Learn how to add login to your regular web application using the Authorization Code Flow.
Read more >Access and authentication for the REST API
To generate a token from the /jwt/login endpoint ; authString, <authentication string> ; Content-type, application/x-www-form-urlencoded ...
Read more >Authentication - Swagger
After you have defined the security schemes in the securitySchemes section, you can apply them to the whole API or individual operations by...
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
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
@dilipkrish do you know any documentation or example that demonstrates how to use SpringFox to document the /login url provided by Spring Security?
I use Spring Boot with Spring Security and all my RESTful Web Service endpoints required an Authorization header(JWT) to be provided. To get the Authorization header value(JWT), user first needs to login. The /login is provided by Spring Security. Once user successfully logs in, Authorization header will be returned. So my Swagger UI Documentation needs to document the /login URL which is provided by Spring Security. I cannot find any documentation on how to document the provided by Spring Security /login endpoint.
Are you aware of any? Can you advise?
The only solution I was able to use these days is to simply create my own /login endpoint and provide SpringFox annotations for it do document Request and Response details. And when Swagger UI is used to send a /login request, Spring Security overrides the request and it works. Which is great. So my own /login endpoint is a kind of Fake login which only serves the documentation purpose. Since Spring Security overwrites it, the code inside of my own, fake /login never gets triggered, which is great and which is what I want. But I wondered how it is properly done with SpringFox? How to use SpringFox to document the /login Web Service Endpoint provided by Spring Security?
@simplyi, we’ve just had the same requirement to document Spring’s /oauth/* endpoints. Eventually a custom ApiListingScannerPlugin plugin worked as in the example - just added the
@Component
and@Order(SwaggerPluginSupport.SWAGGER_PLUGIN_ORDER)
. Note that the group you provide toApiDescription
is NOT the group from yourDocket
(i.e. it’s not the one in drop-down at right top page corner), so by default your ApiDescriptions will appead in every Docket you have under “defaut” section.In order to change the section name you need to provide a tag (surprise, surprise!) for
OperationBuilder
inside yourApiDescription
. And I don’t know whatApiDescription
group is then…