Spring Security: Java Config: How to add the method type?
config, java, spring, spring-security
Solution
If you'd check the documentation of antMatchers method, you will see that enumeration of HttpMethod can be passed as the first parameter.
So something like this should work:
http.authorizeUrls().antMatchers(HttpMethod.POST, "/login").permitAll();
Problem
I'm using Spring Securitys Java Config. Want to translate the following XML: ``` <intercept-url pattern="/login" access="permitAll" method="POST" /> ``` Got it working with Java Config: ``` http.authorizeUrls().antMatchers("/login").permitAll(); ``` But one problem is there: I can still use "/login" with a Browser and do a GET-Request. But I only want that the url can be accessed by POST. Quesion: How can I add this >> method="POST" << to java configuration?