Commit 42525f86 by fukai

支持设置token进入session

parent b7129f90
......@@ -92,6 +92,8 @@ public class LoginController {
RedisLoginInfo redisLoginInfo = new RedisLoginInfo(userId, token, NumericUtil.sessionTimeOut(), sysmodBytes, noUiRequest.getTerminalType());
redisLoginInfo.setUserInr((String)inridf.getValue()); //设置当前用户主键
request.getSession().setAttribute("token",token);
NoUiUtils.logout(userId,"*"); //清理可能存在的历史缓存
RedisUtil.set(StringUtil.userUniqueId(noUiRequest), redisLoginInfo);
......@@ -154,6 +156,7 @@ public class LoginController {
public Object logout(HttpServletRequest request, HttpSession session) {
try {
request.getSession().removeAttribute("toekn");
NoUiRequest noUiRequest = new NoUiRequest(request, "", null);
NoUiUtils.logout(noUiRequest.getUserId(),"*"); //清理可能存在的历史缓存
return ResultUtil.result(ErrorCodes.SUCCESS,"退出成功",null);
......
......@@ -31,6 +31,12 @@ public class ResourceAccessFilter implements Filter {
try {
HttpServletRequest request = (HttpServletRequest) req;
HttpServletResponse response = (HttpServletResponse) res;
if(request.getSession().getAttribute("token")== null)
{
response.setStatus(403);
forbidden(request, response);
return;
}
String uri = request.getRequestURI();
String pdfres;
if ((pdfres=needPdfsFilter(uri))!=null) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment