WebFlux support for Spring Boot and Spring Security Adapters

I have unsuccessfully tried to convert an application using Spring Boot and Spring Security adapters to make use of Spring Boot WebFlux variant.

Unfortuantely, it seems that Keycloak is not built against the WebFlux variant of Spring Boot but the standard servlets variant instead.

Is there a way to activate Spring Boot WebFlux with Keycloak?

3 Likes

https://docs.spring.io/spring-security/site/docs/5.1.x/reference/html/webflux-oauth2.html#webflux-oauth2-login-openid-provider-configuration

1 Like

Thanks.

You are practically recommending the use of Spring Framework provided adapters instead of the Keycloak provided ones.

To be honest, I considered this approach when I started using the Keycloak provided adapters but given some negative past experience with Spring Framework provided variants for other technologies (JMS) I finally trusted the Keycloak provided adapters more.

I will try this and let you know how it goes.

2 Likes

Hey. Have you managed to get keycloak working with webflux? I’m stuck at enabling httpBasic authentication method.

1 Like

I didn’t have time to try the SpringFramework adapters for Keycloak.

The Keycloak adapters are unfortunately too tightly couppled to the non-reactive flavor of SpringFramework and don’t work with reactive flavour of SpringFramework, I have tried.

1 Like

I tried @zonaut’s recommendation to use the standard OAuth2 Spring Boot library and it works.
I stopped using the keycloak adapter because it is still not reactive and causes collisions with webflux.