Class SamlLogoutResponseBuilder

java.lang.Object
org.mockserver.saml.SamlLogoutResponseBuilder

public class SamlLogoutResponseBuilder extends Object
Builds and enveloped-signs a SAML 2.0 <LogoutResponse> for the Single-Logout (SLO) HTTP-POST profile, using only the JDK XML APIs and the JDK XML Digital Signature API (no OpenSAML dependency), mirroring SamlResponseBuilder.

The <LogoutResponse> envelope itself is enveloped-signed (the <ds:Signature> is inserted immediately after its <Issuer>, where the SAML schema requires it), with the signing certificate embedded in <ds:KeyInfo>/<ds:X509Data>, so the SP can validate the signature against the certificate published in the IdP metadata.

  • Constructor Details

    • SamlLogoutResponseBuilder

      public SamlLogoutResponseBuilder()
  • Method Details

    • buildSignedLogoutResponse

      public String buildSignedLogoutResponse(SamlAssertionStore.Provider provider, String inResponseTo)
      Builds a signed SAML LogoutResponse.
      Parameters:
      provider - the mock IdP provider state (supplies issuer, SLO destination, credential)
      inResponseTo - the ID of the SP's LogoutRequest to echo, or null
      Returns:
      the serialized, signed <LogoutResponse> XML