class X509CredentialsExtractor implements CredentialsExtractor  {

    /** Constant <code>CERTIFICATE_REQUEST_ATTRIBUTE="jakarta.servlet.request.X509Certificate"</code> */
    public static final String CERTIFICATE_REQUEST_ATTRIBUTE = "jakarta.servlet.request.X509Certificate";

    private String headerName = CERTIFICATE_REQUEST_ATTRIBUTE;

    @Override
    public Optional<Credentials> extract(final CallContext ctx) {<FILL_FUNCTION_BODY>}
}

        val certificates = (Optional<X509Certificate[]>) ctx.webContext().getRequestAttribute(headerName);

        if (certificates.isPresent() && certificates.get().length > 0) {
            val certificate = certificates.get()[0];
            LOGGER.debug("X509 certificate: {}", certificate);

            return Optional.of(new X509Credentials(certificate));
        }

        LOGGER.debug("No X509 certificate in request");
        return Optional.empty();
    
<no_super_class>