添加 JwtFilter中ThreadLocal需要及时清除

This commit is contained in:
zer0Black
2023-07-28 14:47:39 +08:00
parent 32d54a7436
commit 84ae9a2aa3
2 changed files with 15 additions and 1 deletions
@@ -73,7 +73,7 @@ public class JwtUtil {
}
/**
* 生成签名,5min后过期
* 生成签名
*
* @param username 用户名
* @param secret 用户的密码
@@ -99,4 +99,18 @@ public class JwtFilter extends BasicHttpAuthenticationFilter {
//update-end-author:taoyan date:20200708 for:多租户用到
return super.preHandle(request, response);
}
/**
* JwtFilter中ThreadLocal需要及时清除 #3634
*
* @param request
* @param response
* @param exception
* @throws Exception
*/
@Override
public void afterCompletion(ServletRequest request, ServletResponse response, Exception exception) throws Exception {
//log.info("------清空线程中多租户的ID={}------",TenantContext.getTenant());
TenantContext.clear();
}
}