spring-projects / spring-projects/spring-security

OAuth2LoginAuthenticationFilter not getting associated to redirect-uri attribute value

Open
#17,663 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

status: waiting-for-triage type: bug
Dominant language
Java
Stars
9.6k
Forks
6.3k
Avg merge
2d 11h
Merged PRs (30d)
52

Description

Describe the bug
When we try to override the default redirect uri in application.yml. i expected it to two things:

  1. To associate OAuth2LoginAuthenticationFilter with request pattern mentioned in the redirect-uri property
  2. To send this value as redirect_uri value in the authorization request to provider.
    But, the observation is, it is performing only point #2 above, but still associated OAuth2LoginAuthenticationFilter with default redirect uri which is {}baseUri}/login/oauth2/code/{registrationId}

To Reproduce
Override the redirect-uri like this:

Image and permit the url like this in the security configuration: Image With this, start the application and try to login and access any protected web page

Expected behavior
Below two things should happen

  1. To associate OAuth2LoginAuthenticationFilter with request pattern mentioned in the redirect-uri property
  2. To send this value as redirect_uri value in the authorization request to provider.

And we should be able to login successfully and access any protected web page

Spring Boot version: 3.5.3
Spring Security version: 6.5.1
Java version: 17

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with OAuth2LoginAuthenticationFilter and the configured redirect-uri behavior described in the reproduction. Run the reported Spring Boot 3.5.3 and Spring Security 6.5.1 scenario, then verify that the filter matches the configured request pattern and that the provider receives the same redirect_uri value.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring
Domain
authentication, security
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.