-
Notifications
You must be signed in to change notification settings - Fork 799
Replacement for OAuth2FeignRequestInterceptor from spring-cloud-security? #417
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
@spencergibb this issue was not resolved: the OAuth2FeignRequestInterceptor class was moved to spring-cloud-openfeign, but the dependent classes like OAuth2ClientContext & OAuth2ProtectedResourceDetails have been deprecated and are now missing in spring security 5.x |
I agree. ClientCredentialsResourceDetails is missing too. |
... and what do we do in the mean time then??? |
@spencergibb Is it just moving the classes or is there a bigger problem with the integration? The project will soon be EOL, so a complete migration would be great. |
it's more than moving classes. It is a rewrite. see spring-cloud/spring-cloud-gateway@96be5f4 for the gateway example |
FYI, I managed to code my own "custom" OAuth2FeignRequestInterceptor by following one of the answers here (from @ddewaele ): https://stackoverflow.com/questions/63283022/feign-and-spring-security-5-client-credentials But there are other similar questions @ https://stackoverflow.com/search?q=OAuth2FeignRequestInterceptor |
I can not distill from above comments and stack overflow what is a valid approach bassing on spring security 5. |
looks like Swagger’s default template is using OAuth2 for the client generation along with other custom interceptors. i injected dependency manually with sprinng 2.5.5 and it works: implementation group: 'org.springframework.cloud', name: 'spring-cloud-security', version: '2.0.0.RELEASE' |
Is there an update and a solution here? if not does anyone have an example of what to implement exactly? The example with the gateway didn't get me any further... |
did you check my tips above? |
@mxmlnglt yes a POC works with this approach. Did not try what happen if the token is expired, but IMHO would that be a good general interceptor, but ok. |
Hi, I'm having a problem with this in Spring Boot 3, spring cloud 2022.0.3, and spring-security-oauth 2.5.2-RELEASE. I'm trying to generate a feign client with the usage of openapi-generator-maven-plugin and I keep getting the error:
The pom file I'm using: `
The above-proposed solution can't be used because everything is auto-generated. Did anybody else encounter this problem? |
@mikeut I think you are in the wrong issue tracker, this is related to the open api generator project. |
Uh oh!
There was an error while loading. Please reload this page.
Is your feature request related to a problem? Please describe.
For my Feign Clients I need to add an RequestInterceptor which enhances the requests with an OAuth Bearer Token. I still use the OAuth2FeignRequestInterceptor. But it simply states
@deprecated will move to Spring Cloud Openfeign in next major release
I need quite it's features as the oAuth provider Auth0 requires a non standard attribute "audience" - so I configure the interceptor with customized versions of DefaultOAuth2ClientContext, DefaultAccessTokenRequest, DefaultRequestEnhancer, ClientCredentialsAccessTokenProvider (which themselves all get @deprecated - but the Migration Guide doesn't really help me yet)
Describe the solution you'd like
A 1:1 replacement for the OAuth2FeignRequestInterceptor
or an equivalent which can handle additional attributes in the token request needed for Auth0 ("audience").
Describe alternatives you've considered
I stay with the deprecated OAuth2FeignRequestInterceptor and ignore all the Warnings in the logs and IDE 👎
Additional context
There is also a question on StackOverflow addressing this issue from somebody else - but no answers or ideas yet.
The text was updated successfully, but these errors were encountered: