| | |
| | | import org.springframework.stereotype.Component; |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.ruoyi.common.constant.HttpStatus; |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.common.core.domain.Result; |
| | | import com.ruoyi.common.utils.ServletUtils; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | |
| | | /** |
| | | * 认证失败处理类 返回未授权 |
| | | * |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @Component |
| | |
| | | { |
| | | int code = HttpStatus.UNAUTHORIZED; |
| | | String msg = StringUtils.format("请求访问:{},认证失败,无法访问系统资源", request.getRequestURI()); |
| | | ServletUtils.renderString(response, JSON.toJSONString(AjaxResult.error(code, msg))); |
| | | ServletUtils.renderString(response, JSON.toJSONString(Result.error(code, msg))); |
| | | } |
| | | } |