spring cloud gateway 使用oauth2+jwt鉴权与认证出现问题
来源:6-9 使用JWT替换默认令牌

慕后端2292607
2020-09-25
看了课程后,自己动手搭建基于spring cloud gateway +oauth2.0+jwt方式搭建一套认证与鉴权服务在搭建完代码后,测试时候出现如下问题:
{"error":"unauthorized","error_description":"Error creating bean with name 'scopedTarget.clientDetailsService' defined in class path resource [org/springframework/security/oauth2/config/annotation/configuration/ClientDetailsServiceConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.security.oauth2.provider.ClientDetailsService]: Factory method 'clientDetailsService' threw exception; nested exception is java.lang.UnsupportedOperationException: Cannot build client services (maybe use inMemory() or jdbc())."}
我之前初步也是以为没有配置client的但是在实际代码已经添加了配置了,如下:
1回答
-
JoJo
2020-10-12
不能用gateway,只能用zuul,因为gateway是响应式的,会有线程切换,而spring security是依赖ThreadLocal传递认证信息的。
022020-10-16
Spring Security技术栈开发企业级认证与授权
2662 学习 · 1561 问题
相似问题