栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 面试经验 > 面试问答

在HTTPS /SSL中使用RedirectView后,Spring的SecurityContextHolder.getContext()。getAuthentication()返回null

面试问答 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

在HTTPS /SSL中使用RedirectView后,Spring的SecurityContextHolder.getContext()。getAuthentication()返回null

SecurityContextHolder.getContext().getAuthentication()
既然是threadbound重定向后成为空是正确的。但是应该从会话中重新填充它。因此,请尝试跟踪
SPRING_SECURITY_CONTEXT
会话中的属性。以下是一些示例代码,可以帮助您理解:

HttpSession session = request.getSession(true);System.out.println(session.getAttribute("SPRING_SECURITY_CONTEXT"));

在Spring Security文档中,有一个关于HTTPS / HTTP切换如何使会话搞糟的部分,也许这暗示了您的问题。
http://static.springsource.org/spring-
security/site/faq.html#d0e223

上面的常见问题解答可以检查您的应用程序中如何处理会话。我可能会开始研究AuthenticationSuccessHandler实现。(如果愿意,可以将其插入您的问题中。)

有关如何在Web应用程序中处理安全上下文的更多详细信息,请参见以下内容:(第5.4节):http :
//static.springsource.org/spring-
security/site/docs/3.0.x/reference/technical-overview。
html



转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/372240.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号