Skip to content
This repository was archived by the owner on May 31, 2022. It is now read-only.
This repository was archived by the owner on May 31, 2022. It is now read-only.

AuthorizationServerSecurityConfiguration does not whitelist OPTIONS #1512

Closed
@chrylis

Description

@chrylis

A large number of questions on Stack Overflow and elsewhere boil down to "Spring Security OAuth2 always fails OPTIONS preflights with 401". After some debugging, I have traced this to the parallel security chain that is installed by AuthorizationServerSecurityConfiguration, which invokes authorizeRequests fullyAuthenticated for the OAuth token endpoints but fails to whitelist the OPTIONS method. Since OPTIONS is always issued without authorization, this always fails.

Immediately after http should be the rule antMatchers(HttpMethod.OPTIONS).permitAll(), or alternately excluding OPTIONS requests in the requestMatchers section.

I'm aware that this module is on its way out in favor of the New And Improved OAuth2 support, but as authorization-server support there is not production-ready yet, I request a patch for this bug, as the usual workaround is to insert a CorsFilter that blindly (and opaquely) wipes Spring MVC CORS management.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions