|
|
@@ -15,6 +15,7 @@ import nju.seec.helper.exception.HelperException;
|
|
|
import nju.seec.helper.service.UserService;
|
|
|
import nju.seec.helper.util.Consts;
|
|
|
import nju.seec.helper.vo.UserVO;
|
|
|
+import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
@@ -29,6 +30,9 @@ import java.util.Map;
|
|
|
@RestController
|
|
|
@RequestMapping("/api/user")
|
|
|
public class UserController {
|
|
|
+ @Value("${helper.user-timeout-seconds}")
|
|
|
+ private int userTimeoutSeconds;
|
|
|
+
|
|
|
private final UserService userService;
|
|
|
|
|
|
public UserController(UserService userService) {
|
|
|
@@ -65,8 +69,7 @@ public class UserController {
|
|
|
.setType(userVO.getType());
|
|
|
|
|
|
session.setAttribute(Consts.SESSION_USER_NAME, user);
|
|
|
- // 永不过期
|
|
|
- session.setMaxInactiveInterval(0);
|
|
|
+ session.setMaxInactiveInterval(userTimeoutSeconds);
|
|
|
return userVO;
|
|
|
}
|
|
|
|