Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integrating fusionAuth (Oauth) with Spring cloud gateway (Reactive) #10

Open
najafian opened this issue Nov 16, 2022 · 4 comments
Open

Comments

@najafian
Copy link

najafian commented Nov 16, 2022

_I've got a problem to integrate fusionAuth with spring cloud gateway. can you help me on this issue?

this is my application.properties_

spring.security.oauth2.resourceserver.jwt.issuer-uri=${domain.oauth}/oauth/token

spring.security.oauth2.client.provider.global.issuer-uri=${domain.oauth}/oauth/token
spring.security.oauth2.client.provider.global.authorizationUri=${domain.oauth}/oauth/authorize
spring.security.oauth2.client.provider.global.jwk-set-uri=${domain.oauth}/token_keys
spring.security.oauth2.client.provider.global.user-name-attribute=user_name

spring.security.oauth2.client.provider.fusion.issuer-uri=http://localhost:9011/oauth2/token
spring.security.oauth2.client.provider.fusion.authorizationUri=http://localhost:9011/oauth2/authorize

spring.security.oauth2.client.registration.global.client-name=global-gateway
spring.security.oauth2.client.registration.global.scope=openid, any
spring.security.oauth2.client.registration.global.client-secret=ID
spring.security.oauth2.client.registration.global.client-id=secret

spring.security.oauth2.client.registration.fusion.scope=openid, email
spring.security.oauth2.client.registration.fusion.client-id=ID
spring.security.oauth2.client.registration.fusion.client-secret=secret    
@najafian
Copy link
Author

najafian commented Nov 16, 2022

When I run the application It shows me the error:

_Error creating bean with name 'authorizedClientService' defined in class path resource [org/springframework/boot/autoconfigure/security/oauth2/client/reactive/ReactiveOAuth2ClientConfigurations$ReactiveOAuth2ClientConfiguration.class]: Unsatisfied dependency expressed through method 'authorizedClientService' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'clientRegistrationRepository' defined in class path resource [org/springframework/boot/autoconfigure/security/oauth2/client/reactive/ReactiveOAuth2ClientConfigurations$ReactiveClientRegistrationRepositoryConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.security.oauth2.client.registration.InMemoryReactiveClientRegistrationRepository]: Factory method 'clientRegistrationRepository' threw exception; nested exception is java.lang.IllegalArgumentException: Unable to resolve Configuration with the provided Issuer of "http://localhost:9011/oauth2/token"_

@najafian
Copy link
Author

I added Below Dependencies:

		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-oauth2-resource-server</artifactId>
		</dependency>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-oauth2-client</artifactId>
		</dependency>
		<dependency>
			<groupId>org.springframework.cloud</groupId>
			<artifactId>spring-cloud-starter-security</artifactId>
			<version>2.2.5.RELEASE</version>
		</dependency>
		<dependency>
			<groupId>org.springframework.cloud</groupId>
			<artifactId>spring-cloud-starter-gateway</artifactId>
		</dependency>

@najafian
Copy link
Author

when I add your dependency:

		<dependency>
			<groupId>io.fusionauth</groupId>
			<artifactId>fusionauth-spring-security</artifactId>
			<version>1.0.5</version>
		</dependency>

It gives the below error:

***************************
APPLICATION FAILED TO START
***************************

Description:

Web application could not be started as there was no org.springframework.boot.web.servlet.server.ServletWebServerFactory bean defined in the context.

Action:

Check your application's dependencies for a supported servlet web server.
Check the configured web application type.

Disconnected from the target VM, address: '127.0.0.1:44667', transport: 'socket'

Process finished with exit code 1

@najafian najafian changed the title integrating fusionAuth (Oauth) with Spring cloud gateway Integrating fusionAuth (Oauth) with Spring cloud gateway (Reactive) Nov 17, 2022
@mooreds
Copy link

mooreds commented Nov 18, 2022

@najafian This example is pretty old and I'm not sure exactly what is going wrong. We are working on a new one. I will share it with you when it is done (should be in the next few weeks).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants