-
Notifications
You must be signed in to change notification settings - Fork 6k
oauth2Login() generates authorization links for "client_credentials" grant type #9457
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
Thanks for the report @denisw. The one thing to keep in mind is that the default login page is meant to be used for development / testing only. Production applications will supply their own custom login page. Having said that, I agree that only Would you be interested in submitting a PR for this fix? |
Thank you for the reply, @jgrandja! I'll have a go at creating a pull request. 🙂 |
This prevents the generated login page from showing links for authorization grant types like "client_credentials" which are not redirect-based, and thus not meant for interactive use in the browser. Closes gh-9457
This prevents the generated login page from showing links for authorization grant types like "client_credentials" which are not redirect-based, and thus not meant for interactive use in the browser. Closes gh-9457
This prevents the generated login page from showing links for authorization grant types like "client_credentials" which are not redirect-based, and thus not meant for interactive use in the browser. Closes gh-9457
This prevents the generated login page from showing links for authorization grant types like "client_credentials" which are not redirect-based, and thus not meant for interactive use in the browser. Closes spring-projectsgh-9457
Describe the bug
In Spring Security WebFlux,
OAuth2LoginSpec#getLinks
populates the returned map with authorization links for all registered client registrations, even for those using the"client_credentials"
grant type meant for server-to-server authentication. This has the following consequences:This means that if you have two client registration A with grant type
authorization_code
and another registration B withclient_credentials
, the authorization entry point created by Spring Security WebFlux redirects to the default login page (/login
) rather than directly to the authorization flow of A (/oauth2/authorization/A
). Even worse, that login page will show an authorization link for registration B even though it is not possible for a user to log in through theclient_credentials
OAuth2 flow. In fact, following this link yields a 500 error asDefaultServerOAuth2AuthorizationRequestResolver
(sensibly) does not supportclient_credentials
.To Reproduce
spring.security.oauth2.client.registration
inapplication.yml
:a
withauthorization-grant-type: authorization_code
b
withauthorization-grant-type: client_credentials
ServerHttpSecurity
bean protecting some path withoauth2Login()
Expected behavior
I get redirected to
/oauth2/authorization/a
and then to the OAuth2 provider's login page.The text was updated successfully, but these errors were encountered: