如何解决如何在 Spring Boot 中使用 WebClient 替换 OAuth2RestTempate 的密码授予类型实现
我有以下 OAuth2RestTempate 配置,用于密码授予类型实现,我正在实例化 bean:
@Bean
public OAuth2RestTemplate oAuth2RestTemplate() {
ResourceOwnerPasswordResourceDetails details = new ResourceOwnerPasswordResourceDetails();
details.setAccessTokenUri(this.tokenUrl);
details.setClientId(this.consumerKey);
details.setClientSecret(this.consumerSecret);
details.setGrantType("password");
details.setUsername(this.username);
details.setPassword(this.password);
details.setClientAuthenticationScheme(AuthenticationScheme.form);
OAuth2RestTemplate oAuth2RestTemplate = new OAuth2RestTemplate(details);
oAuth2RestTemplate.setRequestFactory(new HttpComponentsClientHttpRequestFactory());
return oAuth2RestTemplate;
由于 OAuth2RestTemplate 已弃用,我试图用 Spring Boot WebClient 替换它以执行相同的操作,但似乎没有一种简单的方法可以做到这一点。 任何线索表示赞赏。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。