package com.ruoyi.common.security.handler;


import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.utils.FebsUtil;
import org.springframework.security.access.AccessDeniedException;
import org.springframework.security.web.access.AccessDeniedHandler;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @author MrBird
 */
public class FebsAccessDeniedHandler implements AccessDeniedHandler {

    @Override
    public void handle(HttpServletRequest request, HttpServletResponse response, AccessDeniedException accessDeniedException) throws IOException {
        FebsUtil.makeJsonResponse(response, HttpServletResponse.SC_FORBIDDEN, R.fail("没有权限访问该资源"));
    }
}
