| | |
| | | import com.lf.server.entity.all.HttpStatus; |
| | | import com.lf.server.entity.all.ResponseMsg; |
| | | import com.lf.server.entity.all.StaticData; |
| | | import com.lf.server.entity.sys.UsersEntity; |
| | | import com.lf.server.entity.sys.UserEntity; |
| | | import com.lf.server.helper.StringHelper; |
| | | import com.lf.server.helper.WebHelper; |
| | | import com.lf.server.service.sys.TokenService; |
| | |
| | | private static final String NO_TOKEN = JSON.toJSONString(new ResponseMsg<String>(HttpStatus.TOKEN_ERROR, "找不到令牌")); |
| | | |
| | | private static final String NO_LOGIN = JSON.toJSONString(new ResponseMsg<String>(HttpStatus.NO_LOGIN_ERROR, "用户未登录")); |
| | | |
| | | |
| | | public AuthInterceptor(TokenService tokenService) { |
| | | this.tokenService = tokenService; |
| | |
| | | return false; |
| | | } |
| | | |
| | | UsersEntity ue = tokenService.getCurrentUser(request); |
| | | UserEntity ue = tokenService.getCurrentUser(request); |
| | | if (ue == null) { |
| | | WebHelper.write2Page(response, NO_LOGIN); |
| | | return false; |
| | | } |
| | | |
| | | //noinspection AlibabaRemoveCommentedCode |
| | | // 权限校验 |
| | | |
| | | return true; |
| | | } catch (Exception ex) { |
| | | log.error(ex.getStackTrace()); |
| | | log.error(ex.getMessage() + ex.getStackTrace() + "\n"); |
| | | return false; |
| | | } |
| | | } |