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

OAuth2RestOperationsConfiguration$DefaultOAuth2ClientContext and OAuth2AuthorizedClient conflict #51

Closed
huangyangcong opened this issue Oct 8, 2018 · 6 comments

Comments

@huangyangcong
Copy link

duplicate bean

@jzheaux
Copy link
Contributor

jzheaux commented Oct 8, 2018

@huangyangcong could you please share your configuration? It looks like you may be using spring-security-oauth2 as well as spring-security-oauth2-client.

@huangyangcong
Copy link
Author

demo.zip
springboot version 2.1.0.M4
image

@jzheaux
Copy link
Contributor

jzheaux commented Oct 9, 2018

@huangyangcong, this was addressed in #39 which it appears that spring-cloud-starter-oauth2 may not pick up until their 2.1.0.RC1 release.

In the meantime, please use the following property in your application.yml:

spring.main.allow-bean-definition-overriding: true

Let me know if that works for you.

The demo app you uploaded also revealed a related issue, which is why I'm not just yet recommending that you simply override the spring-security-oauth2-autoconfigure dependency in your pom just yet.

@huangyangcong
Copy link
Author

Thank you for your reply to solve my problem.

@jzheaux
Copy link
Contributor

jzheaux commented Oct 9, 2018

@huangyangcong also, OOC, I noticed that you are using @EnableOAuth2Client also with client credentials, which isn't necessary. From the @EnableOAuth2Client java doc:

Enable configuration for an OAuth2 client in a web application that uses Spring Security and wants to use the Authorization Code Grant from one or more OAuth2 Authorization servers.

Is there a reason that you are using @EnableOAuth2Client and client credentials together? (Wondering if there is something in the docs that is suggesting this)?

@huangyangcong
Copy link
Author

I Just learning springcloud and oauth2
http://projects.spring.io/spring-security-oauth/docs/oauth2.html
Different grant types have different concrete implementations of OAuth2ProtectedResourceDetails (e.g. ClientCredentialsResource for "client_credentials" grant type). For grant types that require user authorization there is a further property:
I want to change the authorization code to client credentials。

谢谢您的提醒
Thank you for reminding me

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

2 participants