Browse Source

session销毁

tags/24080901
WendyYang 1 year ago
parent
commit
b9cb8ac5f3
2 changed files with 2 additions and 1 deletions
  1. +1
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/user/controller/UserAuthController.java
  2. +1
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/constants/SessionTimeConstant.java

+ 1
- 1
pmapi/src/main/java/com/ningdatech/pmapi/user/controller/UserAuthController.java View File

@@ -75,7 +75,7 @@ public class UserAuthController {
response.setContentType(StrPool.CONTENT_TYPE); response.setContentType(StrPool.CONTENT_TYPE);
Cookie cookie = new Cookie(BizConst.COOKIE_KEY, null); Cookie cookie = new Cookie(BizConst.COOKIE_KEY, null);
cookie.setPath(request.getContextPath() + "/"); cookie.setPath(request.getContextPath() + "/");
cookie.setMaxAge(SessionTimeConstant.SESSION_TIME_SECONDS);
cookie.setMaxAge(SessionTimeConstant.SESSION_EXPIRED);
response.addCookie(cookie); response.addCookie(cookie);
response.setStatus(HttpStatus.UNAUTHORIZED.value()); response.setStatus(HttpStatus.UNAUTHORIZED.value());
response.getWriter().write(objectMapper.writeValueAsString(BizConst.UNAUTHENTICATED)); response.getWriter().write(objectMapper.writeValueAsString(BizConst.UNAUTHENTICATED));


+ 1
- 0
pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/constants/SessionTimeConstant.java View File

@@ -8,5 +8,6 @@ package com.ningdatech.pmapi.user.security.auth.constants;
public class SessionTimeConstant { public class SessionTimeConstant {


public static final Integer SESSION_TIME_SECONDS = 24 * 60 * 60 * 10; public static final Integer SESSION_TIME_SECONDS = 24 * 60 * 60 * 10;
public static final Integer SESSION_EXPIRED = 0;


} }

Loading…
Cancel
Save