| | |
| | | import com.lf.server.entity.sys.UserEntity; |
| | | import com.lf.server.helper.StringHelper; |
| | | import com.lf.server.helper.WebHelper; |
| | | import com.lf.server.service.all.RedisService; |
| | | import com.lf.server.service.sys.TokenService; |
| | | import org.apache.commons.logging.Log; |
| | | import org.apache.commons.logging.LogFactory; |
| | | import org.springframework.context.annotation.Configuration; |
| | | import org.springframework.data.redis.cache.RedisCache; |
| | | import org.springframework.web.method.HandlerMethod; |
| | | import org.springframework.web.servlet.HandlerInterceptor; |
| | | |
| | |
| | | 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, "用户未登录")); |
| | | |
| | | private static final String USER_LOCK = JSON.toJSONString(new ResponseMsg<String>(HttpStatus.USER_LOCK_ERROR, "用户ID已禁用")); |
| | | |
| | | public AuthInterceptor(TokenService tokenService) { |
| | | this.tokenService = tokenService; |
| | |
| | | return WebHelper.write2Page(response, NO_LOGIN); |
| | | } |
| | | |
| | | Object objCount = tokenService.redisService.get(RedisCacheKey.signPwdError(ue.getUid())); |
| | | if (objCount != null && (int) objCount > SettingData.PWD_ERR_COUNT) { |
| | | return WebHelper.write2Page(response, JSON.toJSONString(new ResponseMsg<String>(HttpStatus.NO_LOGIN_ERROR, SettingData.PWD_ERR_TIME + "分钟内禁止登录"))); |
| | | if (tokenService.isUidDisable(ue)) { |
| | | return WebHelper.write2Page(response, USER_LOCK); |
| | | } |
| | | |
| | | // noinspection AlibabaRemoveCommentedCode |