是否有使用 WebFlux 的 OAuth2 工作示例 [英] Is there working example of OAuth2 with WebFlux

查看:23
本文介绍了是否有使用 WebFlux 的 OAuth2 工作示例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将 OAuth2 添加到 WebFlux,但找不到任何工作示例.

I'm trying to add OAuth2 to WebFlux and can't find any working example.

为了实现自己的授权服务器,我使用了这样的代码:

To Implement own Authorization Server I use such code:

@EnableAuthorizationServer
@Configuration
public class ServerAuth extends AuthorizationServerConfigurerAdapter {
...
}

并且我的 spring boot 应用程序停止工作,因为在 AuthorizationServerConfigurerAdapter 类中使用了 AuthorizationServerSecurityConfigurer 依赖于 javax.servlet.Filter 但在WebFlux 应用程序,没有 Servlet 过滤器.

And my spring boot application stops working because inside AuthorizationServerConfigurerAdapter class there's usage of AuthorizationServerSecurityConfigurer which depends of javax.servlet.Filter but in the WebFlux application, there're no Servlet filters.

此外 AuthorizationServerEndpointsConfigurer 期望使用 UserDetailsS​​ervice(旧的非响应式 API)初始化,而不是响应式 UserDetailsRepository

Also AuthorizationServerEndpointsConfigurer expects to be initialized with UserDetailsService (old non reactive api) not reactive UserDetailsRepository

是否可以在当前的 WebFlux 应用程序中使用 oauth2,如果是,您能举出示例.

Is it possible to use oauth2 in the current WebFlux application if yes could you show the example.

谢谢

推荐答案

授权服务器 webflux 支持尚未由 Spring 安全团队实施.

Authorization server webflux support is yet to be implemented by the spring security team.

目前他们有资源服务器 webflux 支持,正如提到的其他答案.但是,他们在这里提到他们正在使用授权服务器,并且基于此,它应该很快就会发布:

currently they have the resource server webflux support as the other answers mentioned. However, they mention here that they are working on Authorization server and based on this, it should be out soon:

OAuth 2.0 支持目前正在 Spring Security 5 中进行,并提供新的客户端支持.该计划还计划在 2018 年年中为 Resource Server 提供支持,并在 2018 年底或 2019 年初提供对 Authorization Server 的支持.我们的目标是为 OAuth 2.0 核心和扩展、OpenID Connect 1.0 以及 Javascript 对象签名和加密提供广泛支持(何塞).

The OAuth 2.0 support is currently underway in Spring Security 5 with new Client support. The plan is to also provide support for Resource Server by mid-2018 and Authorization Server by the end of 2018 or early 2019. Our goal is to provide extensive support for OAuth 2.0 Core and Extensions, OpenID Connect 1.0, and Javascript Object Signing and Encryption (JOSE).

来源:https://spring.io/blog/2018/01/30/next-generation-oauth-2-0-support-with-spring-security

所以现在我们坚持使用 servlet OAuth2 服务器,如果你问我的话,如果你使用 JWT 令牌应该足够了.

so for now we are stuck with the servlet OAuth2 server which if you use JWT tokens should be good enough if you ask me.

干杯!

这篇关于是否有使用 WebFlux 的 OAuth2 工作示例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆