| | |
| | | import com.matrix.core.tools.RSAUtils; |
| | | import com.matrix.core.tools.StringUtils; |
| | | import com.matrix.system.common.bean.SysUsers; |
| | | import com.matrix.system.common.dao.SysUsersDao; |
| | | import com.matrix.system.hive.bean.SysVipInfo; |
| | | import com.matrix.system.hive.dao.SysVipInfoDao; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Component; |
| | |
| | | @Value("${login_private_key}") |
| | | private String privateKey; |
| | | |
| | | @Value("${evn}") |
| | | private String evn; |
| | | |
| | | @Autowired |
| | | private SysUsersDao sysUsersDao; |
| | | |
| | | private final String TOKEN_HEADER = "Authorization"; |
| | | private final String TOKEN_START_WITH = "Bearer "; |
| | | |
| | | @Override |
| | | public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { |
| | | if ("dev".equals(evn)) { |
| | | SysUsers sysUsers = sysUsersDao.selectById(1012L); |
| | | request.getSession().setAttribute(MatrixConstance.LOGIN_KEY, sysUsers); |
| | | return true; |
| | | } |
| | | |
| | | String token = resolveToken(request); |
| | | AjaxResult ajaxResult = new AjaxResult(); |
| | | ajaxResult.setStatus(AjaxResult.STATUS_LOGIN_INVALID); |
| | |
| | | } |
| | | |
| | | String userStr = redisClient.getCachedValue(token); |
| | | redisClient.resetExpire(token); |
| | | // redisClient.resetExpire(token); |
| | | if (StringUtils.isBlank(userStr)) { |
| | | ajaxResult.setInfo("login time out"); |
| | | response.getWriter().write(new ObjectMapper().writeValueAsString(ajaxResult)); |