Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/spring/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/spring/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Spring 春云醉+;底拖+;OAuth2:无法登录到Zuul_Spring_Spring Boot_Spring Cloud_Spring Security Oauth2 - Fatal编程技术网

Spring 春云醉+;底拖+;OAuth2:无法登录到Zuul

Spring 春云醉+;底拖+;OAuth2:无法登录到Zuul,spring,spring-boot,spring-cloud,spring-security-oauth2,Spring,Spring Boot,Spring Cloud,Spring Security Oauth2,我们使用的是SpringBootV2.0.4+SpringCloud(Finchley版本) 我们已经在各自独立的应用程序/进程中部署了Zuul、Auth Server、Eureka和Config Server。我们部署了半打自己的服务。我们正在对所有服务使用OAuth2身份验证。我们正在为所有应用程序使用嵌入式undertow容器 当Zuul使用嵌入式Undertow容器时,我们无法登录-登录页面将重新显示,即使凭据正确。当Zuul切换到使用嵌入式Tomcat容器时,一切都正常工作——登录会将

我们使用的是SpringBootV2.0.4+SpringCloud(Finchley版本)

我们已经在各自独立的应用程序/进程中部署了Zuul、Auth Server、Eureka和Config Server。我们部署了半打自己的服务。我们正在对所有服务使用OAuth2身份验证。我们正在为所有应用程序使用嵌入式undertow容器

当Zuul使用嵌入式Undertow容器时,我们无法登录-登录页面将重新显示,即使凭据正确。当Zuul切换到使用嵌入式Tomcat容器时,一切都正常工作——登录会将用户带到正确的页面。(所有其他应用程序在这两种情况下都使用Undertow。)

当我们调试通过Zuul对Tomcat和Undertow发出的请求时,我们看到正在为Tomcat设置SPRING\u SECURITY\u上下文会话属性,但没有为Undertow设置。我假设这意味着用户将被重定向回登录页面,这就是我们看到这种行为的原因

我们知道这是Zuul+Tomcat与Undertow的问题,因为所有其他应用程序的配置都保持完全相同


有什么想法吗?我们对这件事真是摸不着头脑。

原来这是由Zuul和Auth Server之间的JSESSIONID cookie名称冲突引起的。因为Tomcat容器对相同名称的多组cookie(这违反了RFC6265)的处理与Wildfly不同,所以我们现在只看到它

我应该提到,我们将auth服务器配置为位于Zuul代理之后,因此使用了多个JSESSIONID cookies

我们现在通过重命名所有后端服务器上的JSESSIONID cookie名称来解决这个问题。我们将研究在以后的生产部署中实现这一点的最佳方法,可能是使用Spring会话。欢迎任何建议