如何修改 a 中的"requestedSessionId"
属性HttpServletRequest
?
public class MySecurityContextPersistenceFilter implements Filter {
@Override
public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) throws IOException, ServletException {
if (req instanceof HttpServletRequest) {
HttpServletRequest httpServletRequest = (HttpServletRequest) req;
httpServletRequest.getRequestedSessionId();
//Modify this value ?
}
}
我尝试这样做的原因是我的客户端应用程序不处理 Cookies..
因此,会话 ID 被发送,"body"
这就是我想要从中获取JSESSIONID
并在请求中设置它以便稍后由SpringSecurityFilterChain
.