【问题标题】:Session cookies are not being sent to the Spring Boot app after authenticating via Okta通过 Okta 进行身份验证后,会话 cookie 不会发送到 Spring Boot 应用程序
【发布时间】:2021-04-27 23:17:43
【问题描述】:

当用户浏览我的 Spring Boot 应用程序时,他们会被重定向到通过 Okta 登录,登录后,他们会被重定向到默认页面,而不是他们请求的原始页面。

我认为发生这种情况的原因是会话 cookie 未发送到服务器,导致服务器无法找到其先前保存的请求。会话 cookie 具有默认为 LaxSameSite 属性,并且由于从 Okta 调用到我的 Spring Boot 应用程序的 SSO URL 是 POST 方法,因此不会发送会话 cookie。为了解决这个问题,我需要配置 Spring 以将会话 cookie 的 SameSite 属性设置为 None,并且我的 Spring Boot 应用程序必须是 https。这听起来对吗?是否有替代解决方案?

【问题讨论】:

    标签: spring-boot cookies spring-security okta spring-saml


    【解决方案1】:

    会话 cookie 必须将 SameSite 属性设置为 NoneSecure 属性。默认情况下,SameSite 属性不是 Spring 设置的,浏览器默认为Lax。这将导致在使用 SSO 和 SAML 时,浏览器不会将会话 cookie 发送到服务器。

    【讨论】:

      猜你喜欢
      • 2015-01-30
      • 2012-03-26
      • 2021-12-28
      • 2017-05-05
      • 2011-06-01
      • 2015-04-30
      • 1970-01-01
      • 2013-12-29
      • 2018-04-13
      相关资源
      最近更新 更多