class Saml2MetadataFilter extends AbstractConfigFilter {

    private String clientName;

    /** {@inheritDoc} */
    @Override
    public void init(final FilterConfig filterConfig) throws ServletException {
        super.init(filterConfig);

        this.clientName = getStringParam(filterConfig, Pac4jConstants.CLIENT_NAME, this.clientName);
    }

    /** {@inheritDoc} */
    @Override
    protected void internalFilter(final HttpServletRequest request, final HttpServletResponse response,
                                  final FilterChain chain)  throws IOException, ServletException {<FILL_FUNCTION_BODY>}

    /** {@inheritDoc} */
    @Override
    public void destroy() {
    }
}


        CommonHelper.assertNotNull("config", getSharedConfig());
        CommonHelper.assertNotNull("clientName", clientName);

        SAML2Client client;
        val result = getSharedConfig().getClients().findClient(this.clientName);
        if (result.isPresent()) {
            client = (SAML2Client) result.get();
        } else {
            throw new TechnicalException("No SAML2 client: " + this.clientName);
        }
        client.init();
        response.getWriter().write(client.getServiceProviderMetadataResolver().getMetadata());
        response.getWriter().flush();
    
<methods>public non-sealed void <init>() ,public void doFilter(jakarta.servlet.ServletRequest, jakarta.servlet.ServletResponse, jakarta.servlet.FilterChain) throws java.io.IOException, jakarta.servlet.ServletException,public org.pac4j.core.config.Config getSharedConfig() ,public void init(jakarta.servlet.FilterConfig) throws jakarta.servlet.ServletException,public void setConfig(org.pac4j.core.config.Config) <variables>private static org.pac4j.core.config.Config CONFIG,private org.pac4j.core.config.Config config,protected final org.slf4j.Logger logger