FusionAuth
    • Home
    • Categories
    • Recent
    • Popular
    • Pricing
    • Contact us
    • Docs
    • Login

    Connecting to fusionAuth as an OAuth2 in spring boot cloud gateway(webflux)

    Scheduled Pinned Locked Moved Unsolved Q&A
    2 Posts 2 Posters 1.6k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • M
      mehdi.motrada
      last edited by

      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?

      danD 1 Reply Last reply
      Reply Quote 0
      • danD
        dan @mehdi.motrada
        last edited by

        @mehdi-motrada Have you worked through this tutorial: https://fusionauth.io/blog/2023/01/03/spring-and-fusionauth ?

        --
        FusionAuth - Identity Without Constraints
        https://fusionauth.io

        1 Reply Last reply
        Reply Quote 0
        • danD dan moved this topic from Q&A on
        • danD dan moved this topic from Frequently Asked Questions (FAQ) on

        Hello! It looks like you're interested in this conversation, but you don't have an account yet.

        Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

        With your input, this post could be even better 💗

        Register Login
        • First post
          Last post