Connecting to fusionAuth as an OAuth2 in spring boot cloud gateway(webflux)
-
Hello FusionAuth,
Recently I am working on spring boot gateway(webflux) and I added fusionAuth as a oauth2 with other oauth2 provider, I added my redirection urls in fusionAuth and the redirection for log-out is working perfect but redirection after login is not working and always fusionAuth app shows me the message "404 Page Missing"!
Here is my application.yml:spring.security.oauth2.client.registration.fusionauth-client.client-name=fusionauth spring.security.oauth2.client.registration.fusionauth-client.scope=email,openid,profile spring.security.oauth2.client.registration.fusionauth-client.client-secret=mSqcm75d2qH93EIGHYfVOxRlII5_KbMFyKBaTrGkTnA spring.security.oauth2.client.registration.fusionauth-client.client-id=77d6819f-e5d1-4628-a55c-e8b089ca8e69 spring.security.oauth2.client.registration.fusionauth-client.redirect-uri=http://car-uk.localhost/auth.php5 spring.security.oauth2.client.registration.fusionauth-client.provider=fusionauth spring.security.oauth2.client.registration.fusionauth-client.client-authentication-method=basic spring.security.oauth2.client.registration.fusionauth-client.authorization-grant-type=authorization_code spring.security.oauth2.client.provider.fusionauth.authorization-uri=http://localhost:9011/oauth2/authorize spring.security.oauth2.client.provider.fusionauth.token-uri=http://localhost:9011/oauth2/token spring.security.oauth2.client.provider.fusionauth.user-info-uri=http://localhost:9011/oauth2/userinfo?schema=openid spring.security.oauth2.client.provider.fusionauth.user-name-attribute=name spring.security.oauth2.client.provider.fusionauth.user-info-authentication-method=header spring.security.oauth2.client.provider.fusionauth.jwk-set-uri=http://localhost:9011/.well-known/jwks.json
and my security configuration Bean class is:
@Bean fun securityWebFilterChain(http: ServerHttpSecurity,repo: ReactiveClientRegistrationRepository): SecurityWebFilterChain { val logoutSuccessHandler = RedirectServerLogoutSuccessHandler() logoutSuccessHandler.setLogoutSuccessUrl(URI.create("/")) val defaultServerOAuth2AuthorizationRequestResolver = DefaultServerOAuth2AuthorizationRequestResolver(repo) defaultServerOAuth2AuthorizationRequestResolver.setAuthorizationRequestCustomizer(OAuth2AuthorizationRequestCustomizers.withPkce()) return http .authorizeExchange { it .anyExchange().authenticated() } .oauth2Login { login-> login.authorizationRequestResolver(defaultServerOAuth2AuthorizationRequestResolver) } .logout().logoutSuccessHandler(logoutSuccessHandler).disable() .cors().and() .csrf().disable() .build() }
Would you please tell me, where my mistake is?
-
@mehdi-motrada Have you worked through this tutorial: https://fusionauth.io/blog/2023/01/03/spring-and-fusionauth ?