Skip to content

permitAll() broken? #13303

Closed
Closed
@UglyHobbitFeet

Description

@UglyHobbitFeet

I am upgrading from Spring 2.7.10 to 3.1. Part of that is converting authorizeRequests to authorizeHttpRequests.

I'm using the example here as a guideline:
https://docs.spring.io/spring-security/reference/servlet/authorization/authorize-http-requests.html#favor-permitall

My old code looked like so and still works in v3.1 but throws deprecation warnings:

  http.authorizeRequests().requestMatchers("/authenticate/**").permitAll().anyRequest().authenticated();

When I modify it to get rid of the deprecation warnings it no longer works:

 http.authorizeHttpRequests((authorize) -> authorize.requestMatchers("/authenticate/**").permitAll().anyRequest().authenticated());

Note that all other config code is identical. The only difference is the one line above to remove the deprecation warning.

Am I doing something wrong or is this a bug? I am calling a url similar to https://someserver/authenticate/blah from a frontend service. FWIW if I call it directly in the browser I notice I do get different HTTP responses for both. i.e. A direct call with authorizeHttpRequests generates a 403 code whereas authorizeRequests generates a 405 code.

Metadata

Metadata

Labels

in: webAn issue in web modules (web, webmvc)status: invalidAn issue that we don't feel is valid

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions