-
Notifications
You must be signed in to change notification settings - Fork 6.1k
Document what is the difference between new requestMatchers and securityMatchers #12950
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
Comments
+1 to the question: the new
After finding similar code samples with roles/authorities but without But would the sample code be like:
with later description something like: Thank you. |
A good example on how to use the new |
@ghusta a good example, thank you Guillaume 👍 |
} |
This part of the document describes the usages and differences quite clearly: |
I think you are correct that this is a typo in the docs and it should be as you corrected it to be. Would you mind opening a new issue or pull request to correct the example here? @craph @pnedonosko @ghusta @onomesotu @ASDasd341 thanks so much for the feedback! In addition to this answer:
I've also recently enhanced the Configuration > Java and Configuration > Kotlin chapters of the reference. Regarding "What is the difference between new requestMatchers and securityMatchers?" based on the opening comment:
I feel like the docs update now answers this question in the section Choosing securityMatcher or requestMatchers. As such, I'm going to close this issue as a duplicate of gh-14419 just for book-keeping since that issue is already resolved. If anyone has additional feedback please don't hesitate to comment here or open a new issue and we can keep improving the docs! |
Hello, I would like to point out that even with the new documentation the difference between requestMatchers and securityMatchers is still completely lost on me (and others). I googled for this and all I found were questions from others what the difference is with no answers, since apparently (almost) no one seems to understand. This notion - imho - is very much untrue:
|
@dsuepke-swisscom thank you so much for your feedback! I am sorry you still do not have a good grasp on this concept. We are actively taking in feedback such as this and working hard on ways to improve Spring Security and make it easier for everyone. We don't yet know what that will look like, but please know that it is a priority. In the meantime, is there anything specific you feel can be done to help improve the situation?
I've tried to outline a set of examples in the above links for 6.4 (starting from Multiple HttpSecurity Instances) that demonstrate the difference. Can you help me improve them? |
Hi @sjohnr, thanks for the quick reply and help. I will try to provide some feedback for improvements. The link you sent is actually more clear to me, don't have anything to add on those atm, good work. Going back to https://docs.spring.io/spring-security/reference/5.8/servlet/authorization/authorize-http-requests.html#_request_matchers, some of the question I have: It seems like "securityMatcher" for I find the name "securityMatcher" confusing. A requestMatcher is matchin a request. What is a securityMatcher matching, security? - probably the HttpSecurity object is meant, but that seem off to me. More appropriate (again, only if I get it right, which I'm not sure of) would be something like "filterChainMatcher". |
Thank you very much! I'm glad it is more clear. Let me know if you have suggestions at any point.
You are correct, that example does not appear to be correct. It should be something like
Your understanding is correct, and |
Example really are confusing... |
Novembre 2024 and the security matcher documentation is still not clear... From the doc: --> 1. Configure HttpSecurity to ONLY be applied to URLs that start with /api/ . Saw some where that the securityMatcher is used to specify a scope where the rules will be applied. I will be very happy if someone can bring more clarifications, if there might be any change or improvement regarding this section. |
Uh oh!
There was an error while loading. Please reload this page.
Expected Behavior
Is it possible to have a more detailled documentation about the difference betwenn new requestMatchers and securityMatchers ?
Current Behavior
After reading this : https://docs.spring.io/spring-security/reference/5.8/migration/servlet/config.html#use-new-security-matchers
there is :
and
It's a little confusing.
Is there any documentation that explains the difference with examples and may be samples with an equivalent with xml configuration to have another view ?
By reading the current documentation, I don't understand when to use securityMatchers
How
securityMatchers
is different fromrequestMatchers
?Context
Thank you very much for your help.
Best regards,
The text was updated successfully, but these errors were encountered: