如何修改"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 ?
}
}
我之所以尝试这样做,是因为我的客户端应用程序无法处理Cookie ..
因此,会话ID会在"body"
中发送,而这就是我想要获取JSESSIONID
的地方,并在请求中进行设置,以便稍后SpringSecurityFilterChain
处理