@Override
    public Credentials validate(final SAML2MessageContext context) {
        val message = (SAMLObject) context.getMessageContext().getMessage();

        // IDP-initiated
        if (message instanceof LogoutRequest logoutRequest) {
            val engine = this.signatureTrustEngineProvider.build();
            validateLogoutRequest(logoutRequest, context, engine);
            return new SAML2Credentials(LogoutType.UNDEFINED, context);

        // SP-initiated
        } else if (message instanceof LogoutResponse logoutResponse) {
            val engine = this.signatureTrustEngineProvider.build();
            validateLogoutResponse(logoutResponse, context, engine);
            return new SAML2Credentials(LogoutType.UNDEFINED, context);
        }

        throw new SAMLException("SAML message must be a LogoutRequest or LogoutResponse type");
    }
{@inheritDoc}

Validates the SAML protocol logout request/response.
pac4j-saml/src/main/java/org/pac4j/saml/logout/impl/SAML2LogoutValidator.java