Skip to content

[REQ] [SPRING-CLOUD] Generates deprecated code #8561

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

Closed
MelleD opened this issue Jan 28, 2021 · 3 comments · Fixed by #16011
Closed

[REQ] [SPRING-CLOUD] Generates deprecated code #8561

MelleD opened this issue Jan 28, 2021 · 3 comments · Fixed by #16011

Comments

@MelleD
Copy link
Contributor

MelleD commented Jan 28, 2021

Is your feature request related to a problem? Please describe.

Deprecated code configurations are generated and spring security depedencies are old.

See spring-cloud/spring-cloud-openfeign#417

@Bean
@ConditionalOnProperty(xyz.client-id")
public OAuth2FeignRequestInterceptor requestInterceptor(OAuth2ClientContext oAuth2ClientContext) {
  return new OAuth2FeignRequestInterceptor(oAuth2ClientContext, resourceDetails());
}
@Bean
@ConditionalOnProperty("xyz.client-id")
public OAuth2ClientContext oAuth2ClientContext() {
  return new DefaultOAuth2ClientContext();
}
@Bean
@ConditionalOnProperty("xyz.client-id")
@ConfigurationProperties("xyz")
public ClientCredentialsResourceDetails resourceDetails() {
  ClientCredentialsResourceDetails details = new ClientCredentialsResourceDetails();
  details.setAccessTokenUri("https://token");
  return details;
}

Describe the solution you'd like

It should support the new classes and configurations

wing328 added a commit that referenced this issue Oct 13, 2021
* Fix import for new spring boot version

#8561

* Add new versions

* Fix samples

* Remove unused dependencies

* Revert "Remove unused dependencies"

This reverts commit bdac08b.

* Add version

* Fix version

* Add hystrix note this depcreated

* Migrate to Junit5

* Trigger build

* Add junit5

* Upgrade to new hystrix starter

* Try to enable hystrix

* Remove hystrix and upgrade to boot 2.5.5

* Remove hystrix

* Revert yaml

* Remove hysterix

* Trigger build

* Update docu

* use 4-space instead of tabs

* remove HystrixCommand

* add back spring-cloud test with oas 3.0 spec

* update samples

Co-authored-by: William Cheng <[email protected]>
@nastya-bakhshyieva
Copy link

nastya-bakhshyieva commented Mar 27, 2023

Have the same issue... Any updates?
Used latest available openapi generator for gradle (version 6.4.0). Generates outdated OAuth2FeignRequestInterceptor. I was expecting to see OAuth2AccessTokenInterceptor or smth

@MelleD
Copy link
Contributor Author

MelleD commented Mar 27, 2023

It's not a openapi generator issue. How you see it is open in spring
spring-cloud/spring-cloud-openfeign#417

@MelleD
Copy link
Contributor Author

MelleD commented Jul 4, 2023

@welshm and @borsch

Currently the solution is described here:
see here https://stackoverflow.com/questions/63283022/feign-and-spring-security-5-client-credentials

The "biggest" impact is that, I found no solution to reuse from the yaml the authorization-grant-type and the uris like token-uri.

So after the change you have to set into the spring boot application properties this information.

Example in our case it looks like:

spring.security.oauth2.client.registration.myProvider.client-id=id
spring.security.oauth2.client.registration.myProvider.client-secret=secret
spring.security.oauth2.client.registration.myProvider.scope=
spring.security.oauth2.client.registration.myProvider.authorization-grant-type=client_credentials
spring.security.oauth2.client.provider.myProvider.token-uri=uri

Before you have not to set authorization-grant-type and token-uri, but currently i found no way to set this information manual in code.

Do you think is okay for the first version?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants