Open madushan-th opened 5 years ago
any solution? i am stuck with same problem.
Can you please share you application.yml?
hey, i attached my api gateway server and oauth server to repository. here is the link. https://github.com/dgempiuc/api-gw-oauth2
I'd recommend using the UAA as your OAuth server.
hey, thanks for your response. i found solution; https://stackoverflow.com/questions/59818343/no-provider-found-for-class-org-springframework-security-oauth2-client-authentic
I'd recommend using the UAA as your OAuth server.
Not the solution to the problem
Hi, I am using my own Authentication server which builds based on Spring boot @EnableAuthorizationServer and implements AuthorizationServerConfigurer when I try to integrate my Authentication server with spring-cloud-gateway-demo the sample which was given by (https://spring.io/blog/2019/08/16/securing-services-with-spring-cloud-gateway) I am getting the following error
.yml file in my gateway ` debug: true server: port: 8081 spring: autoconfigure:
TODO: remove when fixed https://github.com/spring-projects/spring-security/issues/6314
thymeleaf: cache: false security: oauth2: client: registration: gateway: provider: authserver client-id: mobile client-secret: pin authorization-grant-type: authorization_code redirect-uri-template: "{baseUrl}/login/oauth2/code/{registrationId}" scope: READ,WRITE provider: authserver: authorization-uri: http://localhost:9191/oauth/authorize token-uri: http://localhost:9191/oauth/token user-info-uri: http://localhost:9191/user user-name-attribute: sub jwk-set-uri: http://localhost:9191/token_keys ` stack trace...
2019-08-29 11:23:44.881 DEBUG 37816 --- [ctor-http-nio-3] a.w.r.e.AbstractErrorWebExceptionHandler : [7894716c] Resolved [IllegalStateException: No provider found for class org.springframework.security.oauth2.client.authentication.OAuth2AuthorizationCodeAuthenticationToken] for HTTP GET /login/oauth2/code/gateway 2019-08-29 11:23:44.882 ERROR 37816 --- [ctor-http-nio-3] a.w.r.e.AbstractErrorWebExceptionHandler : [7894716c] 500 Server Error for HTTP GET "/login/oauth2/code/gateway?code=QdFv0C&state=j35GmSZr-fLizUXzJ9yy3HRqV1PceAjXcoDq09zjUKs%3D"
java.lang.IllegalStateException: No provider found for class org.springframework.security.oauth2.client.authentication.OAuth2AuthorizationCodeAuthenticationToken at org.springframework.security.web.server.authentication.AuthenticationWebFilter.lambda$authenticate$3(AuthenticationWebFilter.java:99) ~[spring-security-web-5.1.5.RELEASE.jar:5.1.5.RELEASE] at reactor.core.publisher.MonoDefer.subscribe(MonoDefer.java:44) ~[reactor-core-3.2.10.RELEASE.jar:3.2.10.RELEASE] at reactor.core.publisher.Mono.subscribe(Mono.java:3848) ~[reactor-core-3.2.10.RELEASE.jar:3.2.10.RELEASE] at reactor.core.publisher.FluxSwitchIfEmpty$SwitchIfEmptySubscriber.onComplete(FluxSwitchIfEmpty.java:75) ~[reactor-core-3.2.10.RELEASE.jar:3.2.10.RELEASE] at reactor.core.publisher.MonoNext$NextSubscriber.onComplete(MonoNext.java:96) ~[reactor-core-3.2.10.RELEASE.jar:3.2.10.RELEASE] at reactor.core.publisher.FluxConcatMap$ConcatMapImmediate.drain(FluxConcatMap.java:360) ~[reactor-core-3.2.10.RELEASE.jar:3.2.10.RELEASE] at reactor.core.publisher.FluxConcatMap$ConcatMapImmediate.innerComplete(FluxConcatMap.java:289) ~[reactor-core-3.2.10.RELEASE.jar:3.2.10.RELEASE] at reactor.core.publisher.FluxConcatMap$ConcatMapInner.onComplete(FluxConcatMap.java:873) ~[reactor-core-3.2.10.RELEASE.jar:3.2.10.RELEASE] at reactor.core.publisher.MonoFlatMap$FlatMapMain.secondComplete(MonoFlatMap.java:189) ~[reactor-core-3.2.10.RELEASE.jar:3.2.10.RELEASE] at reactor.core.publisher.MonoFlatMap$FlatMapInner.onComplete(MonoFlatMap.java:260) ~[reactor-core-3.2.10.RELEASE.jar:3.2.10.RELEASE] at reactor.core.publisher.FluxMap$MapSubscriber.onComplete(FluxMap.java:136) ~[reactor-core-3.2.10.RELEASE.jar:3.2.10.RELEASE] at reactor.core.publisher.Operators$MultiSubscriptionSubscriber.onComplete(Operators.java:1743) ~[reactor-core-3.2.10.RELEASE.jar:3.2.10.RELEASE] at reactor.core.publisher.Operators$MultiSubscriptionSubscriber.onComplete(Operators.java:1743) ~[reactor-core-3.2.10.RELEASE.jar:3.2.10.RELEASE] at reactor.core.publisher.FluxMapFuseable$MapFuseableSubscriber.onComplete(FluxMapFuseable.java:144) ~[reactor-core-3.2.10.RELEASE.jar:3.2.10.RELEASE] at reactor.core.publisher.MonoFlatMap$FlatMapMain.secondComplete(MonoFlatMap.java:189) ~[reactor-core-3.2.10.RELEASE.jar:3.2.10.RELEASE] at reactor.core.publisher.MonoFlatMap$FlatMapInner.onComplete(MonoFlatMap.java:260) ~[reactor-core-3.2.10.RELEASE.jar:3.2.10.RELEASE] at reactor.core.publisher.MonoNext$NextSubscriber.onComplete(MonoNext.java:96) ~[reactor-core-3.2.10.RELEASE.jar:3.2.10.RELEASE] at reactor.core.publisher.FluxMap$MapSubscriber.onComplete(FluxMap.java:136) ~[reactor-core-3.2.10.RELEASE.jar:3.2.10.RELEASE] at reactor.core.publisher.FluxMap$MapSubscriber.onComplete(FluxMap.java:136) ~[reactor-core-3.2.10.RELEASE.jar:3.2.10.RELEASE] at reactor.core.publisher.FluxPeek$PeekSubscriber.onComplete(FluxPeek.java:252) ~[reactor-core-3.2.10.RELEASE.jar:3.2.10.RELEASE] at reactor.core.publisher.FluxPeek$PeekSubscriber.onComplete(FluxPeek.java:252) ~[reactor-core-3.2.10.RELEASE.jar:3.2.10.RELEASE] at reactor.core.publisher.FluxMap$MapSubscriber.onComplete(FluxMap.java:136) ~[reactor-core-3.2.10.RELEASE.jar:3.2.10.RELEASE] at reactor.netty.channel.FluxReceive.terminateReceiver(FluxReceive.java:390) ~[reactor-netty-0.8.9.RELEASE.jar:0.8.9.RELEASE] at reactor.netty.channel.FluxReceive.drainReceiver(FluxReceive.java:197) ~[reactor-netty-0.8.9.RELEASE.jar:0.8.9.RELEASE] at reactor.netty.channel.FluxReceive.onInboundComplete(FluxReceive.java:338) ~[reactor-netty-0.8.9.RELEASE.jar:0.8.9.RELEASE] at reactor.netty.channel.ChannelOperations.onInboundComplete(ChannelOperations.java:350) ~[reactor-netty-0.8.9.RELEASE.jar:0.8.9.RELEASE] at reactor.netty.channel.ChannelOperations.terminate(ChannelOperations.java:399) ~[reactor-netty-0.8.9.RELEASE.jar:0.8.9.RELEASE] at reactor.netty.http.client.HttpClientOperations.onInboundNext(HttpClientOperations.java:555) ~[reactor-netty-0.8.9.RELEASE.jar:0.8.9.RELEASE] at reactor.netty.channel.ChannelOperationsHandler.channelRead(ChannelOperationsHandler.java:91) ~[reactor-netty-0.8.9.RELEASE.jar:0.8.9.RELEASE] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:374) ~[netty-transport-4.1.36.Final.jar:4.1.36.Final] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:360) ~[netty-transport-4.1.36.Final.jar:4.1.36.Final] at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:352) ~[netty-transport-4.1.36.Final.jar:4.1.36.Final] at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:102) ~[netty-codec-4.1.36.Final.jar:4.1.36.Final] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:374) ~[netty-transport-4.1.36.Final.jar:4.1.36.Final] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:360) ~[netty-transport-4.1.36.Final.jar:4.1.36.Final] at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:352) ~[netty-transport-4.1.36.Final.jar:4.1.36.Final] at io.netty.channel.CombinedChannelDuplexHandler$DelegatingChannelHandlerContext.fireChannelRead(CombinedChannelDuplexHandler.java:438) ~[netty-transport-4.1.36.Final.jar:4.1.36.Final] at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:323) ~[netty-codec-4.1.36.Final.jar:4.1.36.Final] at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:297) ~[netty-codec-4.1.36.Final.jar:4.1.36.Final] at io.netty.channel.CombinedChannelDuplexHandler.channelRead(CombinedChannelDuplexHandler.java:253) ~[netty-transport-4.1.36.Final.jar:4.1.36.Final] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:374) ~[netty-transport-4.1.36.Final.jar:4.1.36.Final] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:360) ~[netty-transport-4.1.36.Final.jar:4.1.36.Final] at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:352) ~[netty-transport-4.1.36.Final.jar:4.1.36.Final] at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1408) ~[netty-transport-4.1.36.Final.jar:4.1.36.Final] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:374) ~[netty-transport-4.1.36.Final.jar:4.1.36.Final] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:360) ~[netty-transport-4.1.36.Final.jar:4.1.36.Final] at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:930) ~[netty-transport-4.1.36.Final.jar:4.1.36.Final] at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:163) ~[netty-transport-4.1.36.Final.jar:4.1.36.Final] at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:682) ~[netty-transport-4.1.36.Final.jar:4.1.36.Final] at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:617) ~[netty-transport-4.1.36.Final.jar:4.1.36.Final] at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:534) ~[netty-transport-4.1.36.Final.jar:4.1.36.Final] at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:496) ~[netty-transport-4.1.36.Final.jar:4.1.36.Final] at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:906) ~[netty-common-4.1.36.Final.jar:4.1.36.Final] at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) ~[netty-common-4.1.36.Final.jar:4.1.36.Final] at java.lang.Thread.run(Thread.java:748) ~[na:1.8.0_151]
2019-08-29 11:23:44.884 DEBUG 37816 --- [ctor-http-nio-3] o.s.core.codec.CharSequenceEncoder : [7894716c] Writing "
Whitelabel Error Page
This application has no configured error view, so you (truncated)... 2019-08-29 11:23:44.885 DEBUG 37816 --- [ctor-http-nio-4] o.s.w.s.adapter.HttpWebHandlerAdapter : [7894716c] Completed 500 INTERNAL_SERVER_ERROR
Process finished with exit code 1