【发布时间】:2011-04-02 07:19:00
【问题描述】:
出于记录目的,我想创建一个记录器,自动将当前会话的 ID 添加到记录的行中。
对于已登录的用户,这不是问题:
((WebAuthenticationDetails) SecurityContextHolder.getContext().getAuthentication().getDetails())
.getSessionId()
问题是,在用户登录之前getAuthentication() 返回null。是否有另一种方法可以在不引用当前响应或任何类似内容的情况下获取会话 ID?
【问题讨论】:
标签: java spring spring-security