springdoc-openapi-security: support custom login processing endpoints#1430
Merged
bnasslahsen merged 3 commits intospringdoc:masterfrom Jan 8, 2022
dotpredicate:security-add-custom-paths
Merged
springdoc-openapi-security: support custom login processing endpoints#1430bnasslahsen merged 3 commits intospringdoc:masterfrom dotpredicate:security-add-custom-paths
bnasslahsen merged 3 commits intospringdoc:masterfrom
dotpredicate:security-add-custom-paths
Conversation
added 3 commits
January 7, 2022 13:52
* access AbstractAuthenticationProcessingFilter class directly instead of calling getSuperclass() * catch ClassCastException for matchers that are not instances of AntPathRequestMatcher * ignore authentication filters that produce errors (such as wrong login endpoints) instead of assuming /login path
Collaborator
|
Thank you @lipniak for your contribution! |
|
@lipniak Can support webflux? |
mpleine
pushed a commit
to mpleine/springdoc-openapi
that referenced
this pull request
May 17, 2025
springdoc-openapi-security: support custom login processing endpoints
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
My application uses a reverse proxy with only
/api/**routes being available to the Spring server. Unfortunately, the login processing endpoint path in springdoc-openapi-security currently is fixed to/loginso I had to make some changes in the code.The new code uses the
requiresAuthenticationRequestMatcherfield ofusernamePasswordAuthenticationFilter(it's private onAbstractAuthenticationProcessingFilterwith no getter so we need to use the Reflection API) to find the login processing endpoint path.I supported only
AntPathRequestMatchermatchers because it is used by all default Spring Security filters when configuring withHttpSecurity. This should cover most use cases.I also have added a test
app8that verifies if a login processing URL set as/api/loginis properly reflected in API schema.