| | |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.system.api.domain.SysUser; |
| | | import com.ruoyi.system.api.feignClient.SysUserClient; |
| | | import org.apache.logging.log4j.core.config.Order; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | |
| | | @Component |
| | | public class AuthFilter implements Filter { |
| | | private static final Logger log = LoggerFactory.getLogger(AuthFilter.class); |
| | | |
| | | |
| | | @Lazy |
| | | @Resource |
| | | private AppUserClient appUserClient; |
| | | |
| | | |
| | | @Lazy |
| | | @Resource |
| | | private SysUserClient sysUserClient; |
| | | |
| | | |
| | | |
| | | |
| | | @Override |
| | | public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException { |
| | | HttpServletRequest request = (HttpServletRequest) servletRequest; |
| | |
| | | //小程序用户 |
| | | if ("applet".equals(userType)) { |
| | | AppUser appUser = appUserClient.getAppUserById(Long.valueOf(userid)); |
| | | if(null == appUser || appUser.getDelFlag() == 1 || 3 == appUser.getStatus()){ |
| | | if(null == appUser || appUser.getDelFlag() || 3 == appUser.getStatus()){ |
| | | log.error("[账户异常处理]请求账户id:{}", userid); |
| | | unauthorizedResponse(response,"无效的账户"); |
| | | return; |
| | |
| | | } |
| | | filterChain.doFilter(servletRequest, servletResponse); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | private void unauthorizedResponse(HttpServletResponse response, String msg) { |
| | | response.setStatus(HttpStatus.OK.value()); |
| | | response.setHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_UTF8_VALUE); |
| | |
| | | writer.flush(); |
| | | writer.close(); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 获取请求token |
| | | */ |
| | |
| | | } |
| | | return token; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | } |