| | |
| | | * @param req |
| | | * @return |
| | | */ |
| | | public Boolean logout(String token, HttpServletRequest req) { |
| | | public Boolean logout(String token, HttpServletRequest req, HttpServletResponse res) { |
| | | TokenEntity te = getEntityByToken(token); |
| | | if (te == null) { |
| | | return false; |
| | | } |
| | | |
| | | // 清除Cookie |
| | | WebHelper.deleteCookie(StaticData.TOKEN_COOKIE_KEY, req); |
| | | // 清除Cookie WebHelper.saveCookie(StaticData.TOKEN_COOKIE_KEY, "", 60, res) |
| | | WebHelper.deleteCookie(StaticData.TOKEN_COOKIE_KEY, req, res); |
| | | |
| | | // 获取当前用户 |
| | | UsersEntity ue = getCurrentUser(req); |
| | |
| | | */ |
| | | public UsersEntity getCurrentUser(HttpServletRequest req) { |
| | | String token = WebHelper.getToken(req); |
| | | if (StringHelper.isEmpty(token)) { |
| | | if (StringHelper.isNull(token)) { |
| | | return null; |
| | | } |
| | | |