Metadata and replay
Facts for metadata trust and replay on the typed browser flows.
recommended() does not select signed metadata, invent trust anchors, or
store replay. Default, new, try_new, and the config builders are
Recommended. Raw settings keep their historical defaults. The preset
distinction is recorded in
validation presets.
Metadata trust is MetadataTrustPolicy, passed to
IdpDescriptor::from_metadata_xml_for and
SpDescriptor::from_metadata_xml_for. Replay is ReplayPolicy, passed to
SamlValidationContext::new. Neither value is a field of
SpValidationPolicy or IdpValidationPolicy. The Web Browser SSO and Single
Logout field combinations do not select signed metadata, invent trust anchors,
or store replay.
Normative text is SAML Metadata 2.0 and Profiles 2.0, as corrected by Approved Errata 05, plus Core 2.0 where a condition is named. Schema citations are the OASIS metadata schema.
Metadata trust
Typed import accepts a document the caller already holds. It does not publish metadata, resolve a well-known location, query DNS, refresh a cache, or follow TLS server authentication. Metadata §4 describes those mechanisms and says other out-of-band mechanisms are permitted. Rules that obligate only that resolution path stay outside this import.
| Rule | Actor | Direction | Level |
|---|---|---|---|
ds:Signature on EntityDescriptor or EntitiesDescriptor |
Metadata publisher | Generate metadata | Optional. The schema marks the element optional. Metadata §3 says a signature is not always required when the relying party obtains the document directly over an authenticated secure channel |
| Sign at least the root element when that channel is absent | Metadata publisher | Generate metadata | Recommendation. Metadata §3. §4.3.3.2 also says published metadata documents should be signed. This import does not reject unsigned metadata because of that publisher recommendation. UnsignedForCompatibility remains the samlify-port import |
| Employ some document-integrity mechanism, and validate a signature that is present, when metadata is resolved through §4 | Metadata publisher and metadata consumer | Resolve metadata | Mandatory for that resolution path. Metadata §4.3.3 and §4.3.3.2. Typed import does not resolve metadata, so the field combination does not apply this duty and does not turn it into a rejection of every unsigned document |
| A relying party has some means to establish trust before using metadata | Metadata consumer | Inbound | Recommendation for resolved metadata. Metadata §4. The means here is the caller-supplied MetadataTrustPolicy. The field combination does not choose it |
KeyInfo on a metadata signature may be absent, and a certificate in KeyDescriptor is not a trust anchor |
Metadata consumer | Inbound | Optional material, with no implied trust. Metadata §3.1.5 lets KeyInfo be absent. Errata 05 E69 takes no position on KeyDescriptor’s ds:KeyInfo and says no trust implication follows from including a certificate. RequireSignature verifies only the caller-pinned certificates and rejects the document when none of them verifies it. UnsignedForCompatibility may still parse a signed document and does not record that signature as verified. The field combination does not turn an unverified signature into trust |
The certificate in a signature’s KeyInfo neither chooses nor restricts the verification key |
Verifier of a message or metadata signature | Inbound | Optional material, with no implied trust. For message signatures, Core §5.4.5, which Errata 05 E91 renumbers §5.4.6, says SAML does not require <ds:KeyInfo> and imposes no restriction on its use. Metadata §3.1.5, which E91 renumbers §3.1.6, says the same for metadata signatures. A signature verifies when one of the peer’s metadata signing keys verifies it, or, for metadata, one of the caller-pinned certificates. A KeyInfo certificate that those keys do not include, such as a re-issued certificate for the same key pair, does not cause a rejection. A signature that none of those keys verifies is not verified, with or without KeyInfo |
A peer’s keys are the KeyDescriptor certificates of the role it acts in |
Metadata consumer | Inbound | Metadata §2.4.1: KeyDescriptor on a role descriptor gives the keys the entity uses when acting in that role. IdpDescriptor and IdpMetadata read certificates from IDPSSODescriptor only, and SpDescriptor and SpMetadata from SPSSODescriptor only. Signatures from a peer are verified, and messages to it encrypted, with its role’s certificates. A message signed with a key that only the peer’s other role publishes is rejected. No OASIS receiver rule names that case, so the rejection is library policy. Metadata::parse has no role and reads every SSO role descriptor |
A role’s name identifier formats are the NameIDFormat elements of that role |
Metadata consumer | Inbound | Metadata §2.4.2: NameIDFormat is an element of SSODescriptorType that enumerates the name identifier formats the entity supports acting in that role. IdpMetadata::get_name_id_format returns the formats of the IDPSSODescriptor read, and SpMetadata::get_name_id_format those of the SPSSODescriptor, in document order. IdentityProvider::from_metadata and ServiceProvider::from_metadata take their configured NameID formats from that list when it is not empty. Which configured format is written is in the Web Browser SSO generation rows. No input is rejected. Metadata::parse has no role and reads every SSO role descriptor |
An endpoint’s Binding, Location, ResponseLocation, index, and isDefault are read with XML Schema whitespace collapse |
Metadata consumer | Inbound | Schema reading. Metadata §2.2.2 types Binding, Location, and ResponseLocation of EndpointType as unqualified anyURI attributes, and §2.2.3 types index of IndexedEndpointType as unsignedShort and isDefault as boolean. XML Schema Part 2 §4.3.6 collapses the whitespace of these datatypes (§§3.2.17, 3.3.23, and 3.2.2). IdpMetadata and SpMetadata collapse space, tab, carriage return, and line feed on every SingleSignOnService, ArtifactResolutionService, SingleLogoutService, ManageNameIDService, and AssertionConsumerService of the role read, and Metadata::parse on every SingleLogoutService, before a binding is matched or a location is returned or compared. A namespace-qualified attribute with one of these local names is a foreign attribute and is not read. A value that is only whitespace is read as empty, and the empty-value handling of each endpoint applies. Library policy: IdpMetadata::artifact_resolution_services returns SamlError::Invalid for an ArtifactResolutionService whose Binding, Location, or index is empty or only whitespace, or that has only a namespace-qualified one. Metadata §§2.2.2 and 2.2.3 mark these attributes required, but the schema allows an empty anyURI, and Core §1.3.2 binds the writer of a URI reference, not the reader. The rejection of an empty or missing attribute predates the whitespace collapse. A value that is only whitespace is the same anyURI as an empty one after the collapse, so it gets the same answer |
| A peer’s role is the role descriptor of that kind that lists SAML 2.0 | Metadata consumer | Inbound | Library policy. Metadata §2.4.1 makes protocolSupportEnumeration a required whitespace-delimited set of URIs naming the protocols a role supports, and says that for SAML V2.0 entities it must include urn:oasis:names:tc:SAML:2.0:protocol. That rule obligates the metadata publisher. Metadata §2.3.2 recommends that role descriptors of one type not share a protocolSupportEnumeration value, and leaves selection among those that do undefined. No clause, and no Approved Errata 05 change, requires a SAML 2.0 relying party to ignore a role that does not list that URI. IdpDescriptor and IdpMetadata read keys, WantAuthnRequestsSigned, NameIDFormat, endpoints, and validUntil only from the IDPSSODescriptor elements in the SAML metadata namespace whose protocolSupportEnumeration lists that URI. SpDescriptor and SpMetadata read SPSSODescriptor the same way. A role that lists only another protocol, such as SAML 1.1, is ignored wherever it appears in the entity. An entity with no such role is refused with SamlError::MissingMetadata naming the element. Several such roles are read together, except the default AssertionConsumerService, which comes from the first, because Errata 05 E37 makes a default the first isDefault endpoint within a role. The restriction keeps a role the peer publishes for another protocol from supplying keys, flags, or endpoints for SAML 2.0 messages. Metadata::parse has no role and reads every SSO role descriptor |
KeyDescriptor use names the key’s purpose |
Metadata consumer | Inbound | Mandatory reading of the published purpose. Errata 05 E62 says signing covers signing, encryption covers wrapping encryption keys, and an omitted use covers both. Signature verification uses the certificates of KeyDescriptors with use="signing" or no use. Encryption uses those with use="encryption" or no use. A key published for one use is never used for the other. Errata 05 E68 says a relying party should allow any key that several KeyDescriptors publish for the same use, so every such certificate is tried when verifying |
Several KeyDescriptor use="signing" on this entity’s role |
SP and IdP metadata publisher | Generate metadata | Optional. Metadata §2.4.1 and the metadata schema’s RoleDescriptorType allow several KeyDescriptor elements. Errata 05 E68 amends §2.4.1.1 so any included key may be used and recommends that relying parties accept any of them. Credentials::additional_signing_certificates publishes each certificate in its own signing descriptor after signing_certificate, in list order. Signing still uses only signing_key and signing_certificate. No receiver rule changes |
Several KeyDescriptor use="encryption" on this entity’s role, and decryption with any of them |
Metadata publisher, and the relying party that decrypts | Generate metadata, inbound decryption | Optional for the publisher, recommendation for the relying party. Metadata §2.4.1 allows several KeyDescriptor elements. Errata 05 E68 amends §2.4.1.1: several KeyDescriptors with the same use, or none, mean any of the included keys may be used by the containing role, and a relying party should allow any of them. Credentials::additional_decryption_keys publishes each certificate after encryption_certificate, in order. Decrypting EncryptedAssertion, EncryptedID, EncryptedAttribute, a LogoutRequest EncryptedID, a requested AuthnRequest subject EncryptedID, and a ManageNameIDRequest EncryptedID or NewEncryptedID tries decryption_key, then each additional key, and keeps the first that decrypts. The RSA-v1.5 key-transport refusal applies before any key is tried. When no key decrypts, the error is the one decryption_key returns. The config builders return SamlError::MissingKey for additional keys without a decryption_key, as for a passphrase without one. That configuration rule is library policy |
entityID is unique across every entity that interacts in one deployment |
Metadata publisher | A deployment | Mandatory. Metadata §2.2.1. The generator writes the caller-supplied identifier and does not police uniqueness across a deployment |
| Role descriptor children follow the schema sequence | Metadata publisher | Generate metadata | Mandatory. The metadata schema declares an xs:sequence for RoleDescriptorType, SSODescriptorType, IDPSSODescriptorType, and SPSSODescriptorType (Metadata §§2.4.1 to 2.4.4). The default elements_order writes it: KeyDescriptor, ArtifactResolutionService, SingleLogoutService, ManageNameIDService, NameIDFormat, then SingleSignOnService or AssertionConsumerService. elements_order::SHIBBOLETH and elements_order::idp::SHIBBOLETH also give that sequence. elements_order::ONELOGIN, elements_order::idp::ONELOGIN, and a caller-supplied list are written as given, so they can produce a document the schema rejects |
Entity-level Organization, then ContactPerson, follow the role descriptors |
Metadata publisher | Generate SP and IdP metadata | Optional elements with mandatory ordering when present. Metadata §2.3.2 and EntityDescriptorType in the OASIS metadata schema. Typed and raw configs expose organization and contacts; builders expose organization and repeatable contact. One shared writer appends them outside the role descriptor, independently of elements_order. Unset fields write nothing. Existing role-child ordering profiles retain their behaviour, including the non-schema ONELOGIN order noted above |
An organization has one or more names, display names, and URLs, each with xml:lang |
Metadata publisher | Generate metadata with Organization |
Mandatory when present. Metadata §§2.2.4, 2.2.5, and 2.3.2.1 and the metadata schema. Generation rejects an empty list, a language tag outside the XML Schema 1.0 §3.3.3 lexical pattern, or XML-forbidden text with SamlError::Invalid. Organization URLs and role errorURL values must be absolute URI references under Core §1.3.2. This does not validate language tags against a registry |
A contact has one enumerated contactType and zero or more mailto: email URIs |
Metadata publisher | Generate metadata with ContactPerson |
Mandatory when present. Metadata §2.3.2.2 defines the five contact types, optional company and names, and repeatable email and telephone elements. ContactType represents the five values plus the security extension. Generation rejects a non-mailto: email URI with SamlError::Invalid; it does not test mailbox delivery |
| Publish the REFEDS security contact extension | Metadata publisher | Generate an explicitly configured security contact | Optional extension. ContactType::Security writes contactType="other" and {http://refeds.org/metadata}contactType="http://refeds.org/metadata/contactType/security" per the REFEDS extension. This supports publishing the extension only. It does not assert Sirtfi compliance or require its additional contact details |
Publish errorURL on the SSO role descriptor |
Metadata publisher | Generate SP and IdP metadata | Optional under Metadata §2.4.1. Typed and raw error_url and the builder method write it only when configured. This does not claim the saml2int profile, which requires it for an IdP |
| Expose entity-level organization and contacts without changing imported XML | Metadata consumer | Read imported metadata | Informative data under Metadata §§2.3.2.1–2.3.2.2. Shared Metadata::organization and contacts return owned values through both raw metadata and typed descriptors. They read direct entity children and resolved namespaces, including inherited XML and REFEDS namespace bindings. Import adds no rejection for description content. The accessors return SamlError::Invalid for multiple organizations, missing xml:lang, or missing or unknown contactType, as applicable. They do not enforce outbound value validation on imported data |
Each written NameIDFormat is an absolute URI reference |
Metadata publisher | Generate metadata | Mandatory. Metadata §2.4.2 makes NameIDFormat an anyURI that names a name identifier format, with Core §8.3 values as examples. The metadata schema alone allows any anyURI. Core §1.3.2 requires a URI reference value in a SAML-defined element to have a non-whitespace character and to be absolute, as read in identifiers. generate_sp_metadata, generate_idp_metadata, and try_generate_idp_metadata return SamlError::Invalid for a written value that is not one, and so do Saml::sp and Saml::idp for a configured NameIdFormat. Every value is checked, not only the first. A format the element order leaves out is not written and not checked. Service provider metadata without a configured format advertises emailAddress |
Each AssertionConsumerService index is unique within its SPSSODescriptor |
Metadata publisher | Generate metadata | Mandatory. Metadata §2.2.3 makes index a required unique unsignedShort among like elements in the same parent. generate_sp_metadata and Saml::sp return SamlError::Invalid when two endpoints set the same index. An endpoint without one is written with its position, or with the smallest unused index when another endpoint already has that position. Metadata import does not reject a duplicate. Looking up an index that several endpoints share returns SamlError::Invalid |
isDefault appears only on an indexed endpoint |
Metadata publisher | Generate metadata | Mandatory. The metadata schema declares isDefault on IndexedEndpointType only. SingleSignOnService, SingleLogoutService, and ManageNameIDService are EndpointType, and Metadata §2.2.2 requires any other attribute on them to be namespace-qualified. The generator writes isDefault on AssertionConsumerService only and ignores Endpoint::is_default on other endpoints |
| An enveloped signature on the signed root | Metadata publisher, when signing | Generate the signed element | Mandatory. Metadata §3.1.1. RequireSignature rejects a signature that is not enveloped. The same rule applies to a root EntitiesDescriptor and a root EntityDescriptor |
An identifier on the signed root, and one reference whose URI is # plus that identifier |
Metadata publisher, when signing | Generate the signed element | Mandatory. Metadata §3.1.2. RequireSignature rejects a signed root with no identifier and a signature that does not contain exactly that one reference. The signature must still cover the signed root |
| No transform other than enveloped signature or exclusive canonicalization, with or without comments | Signer and verifier | Inbound RequireSignature |
Recommendation. Metadata §3.1.4. RequireSignature rejects other transforms. RequireSignatureAllowingOtherCanonicalization also accepts inclusive canonicalization, and still rejects a transform that can drop part of the signed element |
No ds:Object in a metadata signature |
Verifier | Inbound RequireSignature |
Recommendation. Approved Errata 05 E91 says verifiers should reject ds:Object because it can carry unsigned data. All require-signature options reject it. There is no relaxation |
No ds:Object in a message signature |
Verifier of a message signature | Inbound | Recommendation. Core §5.4.5, added by Approved Errata 05 E91, says verifiers should reject a signature that contains ds:Object because it can carry unsigned data. Under XmlSignatureProfile::ExcludeWeakAlgorithms, the value Recommended uses, and StrictRsaSha2, a signature that authenticates the accepted Response, Assertion, AuthnRequest, LogoutRequest, or LogoutResponse and has a ds:Object child returns SamlError::SignedReferenceMismatch, on HTTP-POST and SOAP alike. AllowProviderSupportedForCompatibility, which Compatibility and the raw API use, relaxes it |
| No MD5 or RIPEMD-160 signature or digest algorithm, and no RSA signing key shorter than 2048 bits, on a metadata signature | Metadata consumer | Inbound RequireSignature |
Library policy, on. No OASIS rule requires the rejection. Metadata §3.1.1, as replaced by Errata 05 E81, says any algorithm defined for use with XML Signature may be used, and Conformance §4.1 with E50 makes its list a minimal set. XML Signature 1.1 §6.2 says MD5 SHOULD NOT be used in DigestMethod, a rule on use, and §6.4.2 lets a verifier use an RSA key of 1024 bits or less. The rejection protects the trust root of the peer’s keys: the certificates a verified document publishes are then trusted for its messages. RequireSignature and RequireSignatureAllowingOtherCanonicalization reject such an algorithm with SamlError::AlgorithmUnsupported on a build that verifies it, and do not verify with a pinned RSA certificate shorter than 2048 bits. RequireSignatureAllowingWeakAlgorithmsForCompatibility relaxes it and keeps the transform rules of RequireSignature. The algorithms are listed in weak algorithms and keys |
When RequireSignature is selected, the signature covers the signed root |
Metadata consumer | Inbound | Mandatory once that caller option is selected. Metadata §3.1.2 requires the signature to cover the signed element and its children. The import rejects a signature that does not cover the root |
A root EntityDescriptor or EntitiesDescriptor carries validUntil or cacheDuration |
Metadata publisher | Generate a root metadata instance | Mandatory. Metadata §2.3.1 and §2.3.2. MetadataLifetime writes validUntil, cacheDuration, or both on the generated root EntityDescriptor. It is the lifetime field of the typed and raw SpMetadataConfig and IdpMetadataConfig, and the metadata_lifetime builder method. validUntil is written in UTC and truncated to whole seconds. Without a lifetime the generator writes neither attribute, which this rule forbids. That default is existing behaviour, preserved here. The importer does not reject the omission |
Do not use metadata at or after validUntil |
Metadata consumer | Use metadata | Mandatory when the attribute is present. Errata 05 E94 adds §4.3.2: metadata must be treated as invalid at that time, and invalid metadata must not be used. The effective expiration is adjusted downward by parent elements, and a nested value may only shorten the parent (E76). IdpDescriptor and SpDescriptor import keep the earliest validUntil of the enclosing EntitiesDescriptor elements, the EntityDescriptor, and the role descriptors that descriptor reads: IDPSSODescriptor or SPSSODescriptor. Every typed flow that uses the descriptor returns SamlError::TimeWindowInvalid with TimeWindowField::MetadataValidUntil at or after that instant. A flow that takes a SamlValidationContext compares with its clock; any other flow compares with the system clock. No clock skew applies. Another role descriptor of the entity does not bound this role. When the entity has several descriptors of this role, the earliest bounds all of them, because the descriptor reads them together; that is library policy. Import returns the same error for a value that is not an xs:dateTime with a timezone. Rejecting a schema-valid value without a timezone is library policy: XML Schema 1.0 §3.2.7.4 leaves its order against an instant indeterminate, so the expiry cannot be decided. Import also rejects hour 24, a leap second other than 23:59:60 UTC on the last day of a month, and a year outside 0001 through 9999, which XML Schema allows; that is library policy too. Import reads validUntil by local name, so a validUntil attribute in another namespace is read as the SAML attribute. Metadata::parse and the raw API do not evaluate validUntil |
Base caching on cacheDuration |
Metadata consumer | Cache resolved metadata | Mandatory for a consumer that caches. Errata 05 E94 replaces §4.3.1: caching follows cacheDuration, and a stale copy may still be used. E76 lets a nested value only shorten the parent. Typed import does not cache metadata, so this is not a preset field. An elapsed cacheDuration does not make a descriptor unusable, because E94 distinguishes stale metadata from invalid metadata |
Replay
ReplayPolicy::DisabledForCompatibility skips storage. It is the samlify-port
hatch. It is not a named relaxation of a recommendation.
ReplayPolicy::RequireCache stores only in the cache the caller passes.
SamlValidationContext has no hidden cache.
| Rule | Actor | Direction | Level |
|---|---|---|---|
| Bearer assertions delivered by HTTP POST are not replayed | Accepting service provider | Inbound finish_sso and accept_unsolicited_sso |
Mandatory for HTTP POST. Profiles §4.1.4.5. Approved Errata 05 E26 replaces only the signing sentence at lines 600–601 and leaves this paragraph in place. The check stays on ReplayPolicy. The accept combination does not enable it. DisabledForCompatibility is the samlify-port hatch for this mandatory rule |
The kept HTTP POST identifier is the bearer assertion ID, for the SubjectConfirmationData@NotOnOrAfter window |
Accepting service provider | Inbound | Mandatory for the HTTP POST rule above. Profiles §4.1.4.5 names that identifier and that window. The stored deadline is that attribute plus the context NotOnOrAfter skew. Profiles §4.1.4.3 checks bearer NotOnOrAfter subject to allowable clock skew, and Approved Errata 05 E92 is the guidance for that allowance. An earlier Conditions or AuthnStatement instant does not shorten the assertion identifier. With several bearer confirmations, the window is the latest bearer NotOnOrAfter that parses as an instant, for the session assertion and every other direct assertion alike. Profiles §4.1.4.3, as replaced by Approved Errata 05 E26, needs only one bearer confirmation to satisfy the checks, and that one parses, so a value that does not parse is ignored for the deadline and does not fail replay storage. Choosing the latest value is library policy. It keeps the identifier at least as long as the confirmation that satisfied the checks |
Also store the Response ID |
Accepting service provider | Inbound | Library policy. It is stored only when the caller supplies a cache. Its deadline remains the earliest of Conditions, bearer SubjectConfirmationData, and every AuthnStatement, plus the same skew. That deadline can be earlier than the assertion identifier |
| The same caller cache on HTTP-Redirect or HTTP-POST-SimpleSign responses | Accepting service provider | Inbound | Library policy. Profiles §4.1.4.5 states the replay duty for HTTP POST. Security considerations §7.1.1.4 defers replay countermeasures to the binding and does not add a second receiver requirement. Storage on the other response bindings happens only when the caller supplies a cache |
AuthnRequest ID |
Identity provider | Inbound receive_sso |
Library policy. Web Browser SSO does not require the identity provider to remember request identifiers. receive_sso stores the ID only when the caller supplies a cache, and that path always requires SamlValidationContext::with_replay_retention. It does not read NotOnOrAfter |
LogoutRequest ID |
Logout recipient | Inbound receive_slo |
Library policy. Single Logout does not require an identifier cache. Storage happens only when the caller supplies a cache. The deadline is NotOnOrAfter plus the context NotOnOrAfter skew when that attribute is present; otherwise the caller must set with_replay_retention. Rejecting an expired LogoutRequest@NotOnOrAfter remains the separate library policy already recorded for logout |
LogoutResponse ID |
Original requester | Inbound finish_slo |
Library policy. Single Logout does not require an identifier cache. finish_slo stores the ID only when the caller supplies a cache, and that path always requires with_replay_retention. It does not read NotOnOrAfter |
Do not retain an assertion that carries <OneTimeUse> |
Relying party that would retain the assertion | Inbound | Mandatory when the element is present. Core §2.5.1.5 MUST NOT be retained for future use. For validity, the condition is always Valid. Typed SSO does not retain the assertion for later protocol use, so this is not a preset field and it is not part of the caller replay cache |
Use a <OneTimeUse> assertion immediately |
Relying party | Inbound | Recommendation. Core §2.5.1.5. It does not become a rejection of an assertion that arrives later |