class AuthorizationFilter implements Filter {

    private static final Logger LOGGER = LoggerFactory.getLogger(AuthorizationFilter.class);

    @Override
    public void init(FilterConfig fc) {<FILL_FUNCTION_BODY>}

    /**
     * All RESTful API requests are allowed here because they go through
     * {@link org.opengrok.web.api.v1.filter.IncomingFilter}.
     * The /search endpoint will go through authorization via SearchEngine.search()
     * so does not have to be exempted here.
     */
    @Override
    public void doFilter(ServletRequest sr, ServletResponse sr1, FilterChain fc) throws IOException, ServletException {
        HttpServletRequest httpReq = (HttpServletRequest) sr;
        HttpServletResponse httpRes = (HttpServletResponse) sr1;

        if (httpReq.getServletPath().startsWith(RestApp.API_PATH)) {
            if (LOGGER.isLoggable(Level.FINER)) {
                LOGGER.log(Level.FINER, "Allowing request to {0} in {1}",
                        new Object[] {Laundromat.launderLog(httpReq.getServletPath()),
                                AuthorizationFilter.class.getName()});
            }
            fc.doFilter(sr, sr1);
            return;
        }

        PageConfig config = PageConfig.get(httpReq);

        Project p = config.getProject();
        if (p != null && !config.isAllowed(p)) {
            if (LOGGER.isLoggable(Level.INFO)) {
                if (httpReq.getRemoteUser() != null) {
                    LOGGER.log(Level.INFO, "Access denied for user ''{0}'' for URI: {1}",
                            new Object[] {Laundromat.launderLog(httpReq.getRemoteUser()),
                                    Laundromat.launderLog(httpReq.getRequestURI())});
                } else {
                    LOGGER.log(Level.INFO, "Access denied for URI: {0}",
                            Laundromat.launderLog(httpReq.getRequestURI()));
                }
            }

            if (!config.getEnv().getIncludeFiles().getForbiddenIncludeFileContent(false).isEmpty()) {
                sr.getRequestDispatcher("/eforbidden").forward(sr, sr1);
                return;
            }

            httpRes.sendError(HttpServletResponse.SC_FORBIDDEN, "Access forbidden");
            return;
        }
        fc.doFilter(sr, sr1);
    }

    @Override
    public void destroy() {
        // Empty since there is No specific destroy configuration.
    }

}

        // Empty since there is No specific init configuration.
    
<no_super_class>