Is there working example of OAuth2 with WebFlux

坚强是说给别人听的谎言 提交于 2019-12-03 15:46:20

问题


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 {
...
}

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.

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

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

Thanks


回答1:


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

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:

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).

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

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.

Cheers!




回答2:


It's implemented now, here the reference to the sample code:

https://github.com/spring-projects/spring-security/tree/master/samples/boot/oauth2login-webflux



来源:https://stackoverflow.com/questions/46798705/is-there-working-example-of-oauth2-with-webflux

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!