SAML metadata: exchange IdP and SP settings safely
Learn what SAML metadata describes, how to verify its source and signature, and how to manage expiry and key rollover.
SAML metadata: exchange IdP and SP settings safely
SAML metadata is structured XML that lets an Identity Provider (IdP) and Service Provider (SP) exchange entity IDs, supported roles, endpoints, bindings, and public-key information. Treat it as input to the federation trust boundary, not merely an endpoint list: verify its source and integrity, and manage changes, expiry, and key rollover. An omitted capability is not proof it is unsupported; a declared capability is not a guarantee it is available to every partner.
What the document contains
EntityDescriptor is the basic unit; entityID identifies the SAML entity. Role descriptors describe roles such as IdP or SP and their capabilities. IDPSSODescriptor can list SSO services and signing keys; SPSSODescriptor can list Assertion Consumer Services (ACS), request-signing settings, and encryption keys. Endpoints include a binding and location.
| Element | Use | Check |
|---|---|---|
entityID | IdP/SP identifier | Exact match with the partner agreement |
IDPSSODescriptor / SPSSODescriptor | Role and protocol support | Required profile/protocol is declared |
SingleSignOnService | IdP request destination | Binding and location match the agreement |
AssertionConsumerService | SP response destination | Endpoint, binding, index/default match deployment |
KeyDescriptor | Public key for signature validation or encryption | Key use and rollover timing are agreed |
SingleLogoutService | Logout endpoint, if supported | Support, registration, and binding match |
validUntil / cacheDuration | Expiry or maximum cache period | Apply parent limits and retrieval time |
Establish trust in the source
Being able to parse partner XML does not make its contents trustworthy. A metadata signature can provide integrity and authenticate a trusted signer. Unsigned metadata still needs a trust basis, such as an authenticated channel for obtaining the partner-published document.
Confirm the partner, official publication channel, entity ID, environment (test or production), and contact.
Parse with a secure XML parser; check namespaces and schema. Do not enable unapproved external-entity resolution.
For signed metadata, verify the signature and referenced elements using a key obtained through a separate trust process. A certificate embedded in the same document does not establish its own trust.
Compare entity IDs, roles, endpoint hosts, bindings, key uses, and certificate expiry/rollover with the agreement.
Approve changes and coordinate rollout and rollback. Agree how long old and new keys overlap.
Do not use metadata beyond `validUntil`. When `cacheDuration` is present, calculate the cache limit from retrieval time. A parent element's cache/expiry policy can take precedence. Expired metadata requires a fresh copy; record last successful refresh, alert on refresh failure, and define a safe stop/failure policy.
Signature validation alone does not secure the whole integration. Confirm that the XML-signature library's verified entity, endpoint, and key are the ones actually used, and approve endpoint URLs as belonging to the trusted partner.
Verify the exchange
In a test IdP/SP pair, check that the IdP targets the current SP entityID, the exposed ACS matches the registered endpoint, both parties use the agreed binding/signature rules, key rollover works during the agreed overlap, and expired or invalidly signed metadata triggers a warning or safe stop rather than an automatic trust change. This is a verification plan, not a reported test. Do not alter production metadata or copy real signing keys into samples.
Common failures: check the correct role descriptor, environment URL, and binding when an endpoint fails; check trust anchor, key use, rollover, certificate, and XML signature reference when validation fails; confirm omitted capabilities separately with the partner; and monitor refresh failures and cache/expiry policy for stale settings.
References
[OASIS SAML V2.0 Metadata](https://docs.oasis-open.org/security/saml/v2.0/saml-metadata-2.0-os.pdf)
[OASIS SAML V2.0 Technical Overview](https://docs.oasis-open.org/security/saml/Post2.0/sstc-saml-tech-overview-2.0.html)