Package org.mockserver.saml
Class SamlProviderGenerator
java.lang.Object
org.mockserver.saml.SamlProviderGenerator
Generates MockServer
Expectations that stand up a complete mock SAML 2.0 Identity
Provider implementing the SP-initiated Web-Browser-SSO POST profile, so applications using SAML
SSO can be tested without a real IdP.
Up to three endpoints are generated:
GET <metadataUrl>— returns SAML 2.0 IdP metadata XML (anEntityDescriptorwith anIDPSSODescriptor, the signing X.509 certificate, aSingleSignOnServiceand (when an SLO path is configured) aSingleLogoutService, both with the HTTP-POST binding).GET/POST <ssoServiceUrl>— aSamlSsoCallbackclass callback that returns an auto-submitting HTML form POSTing a base64-encoded, XML-DSig-signed SAMLResponseto the SP's assertion consumer service, echoingRelayState.GET/POST <sloServiceUrl>— aSamlSloCallbackclass callback that returns an auto-submitting HTML form POSTing a signed SAMLLogoutResponseto the SP's Single-Logout service, echoingRelayState(omitted when no SLO path is configured).
The signing credential is taken from the configuration if supplied, otherwise a self-signed
RSA credential is generated (see SamlSigningCredential). All SAML XML is built with the
JDK XML APIs and enveloped-signed with the JDK XML Digital Signature API — no OpenSAML dependency.
Usage mirrors OidcProviderGenerator: call
generate(SamlProviderConfiguration) and upsert the returned expectations.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongenerate(SamlProviderConfiguration config) Generates SAML IdP expectations from the given configuration.
-
Constructor Details
-
SamlProviderGenerator
public SamlProviderGenerator()
-
-
Method Details
-
generate
Generates SAML IdP expectations from the given configuration.- Parameters:
config- the provider configuration (must not be null)- Returns:
- the generated expectations (metadata + SSO endpoint)
-