Beta

Create a tenant

A new tenant starts with its own users, OAuth settings, audit history and logs. You are its first Tenant Admin.

Metadata, certificates, and key rollover

Cedar Inc. and the training service agree on names, addresses and keys before Avery's first sign-in, and they write that agreement down as metadata. Keys still have to change, and changing one without breaking every sign-in takes an overlap planned in advance.

Agreeing before the first sign-in

Before Avery's first sign-in to the training service, an administrator at each organization had to enter the other side's details: entity ID, endpoints, binding, certificate. Typing them by hand invites mistakes, and a single wrong character in an ACS address is enough to break every sign-in. So each side publishes its details as one XML document, its metadata, and the other side imports it. Here is Cedar Inc.'s, with the certificate shortened:

xml
<md:EntityDescriptor xmlns:md="urn:oasis:names:tc:SAML:2.0:metadata"
    xmlns:ds="http://www.w3.org/2000/09/xmldsig#"
    entityID="https://login.cedar.example"
    validUntil="2026-11-12T00:00:00Z" cacheDuration="PT24H">
  <md:IDPSSODescriptor WantAuthnRequestsSigned="true"
      protocolSupportEnumeration="urn:oasis:names:tc:SAML:2.0:protocol">
    <md:KeyDescriptor use="signing">
      <ds:KeyInfo><ds:X509Data>
        <ds:X509Certificate>MIIDBzCCAe+gAwIBAgIUQm3x...</ds:X509Certificate>
      </ds:X509Data></ds:KeyInfo>
    </md:KeyDescriptor>
    <md:SingleLogoutService Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect"
        Location="https://login.cedar.example/saml/slo"/>
    <md:NameIDFormat>urn:oasis:names:tc:SAML:2.0:nameid-format:persistent</md:NameIDFormat>
    <md:SingleSignOnService Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect"
        Location="https://login.cedar.example/saml/sso"/>
  </md:IDPSSODescriptor>
</md:EntityDescriptor>

entityID is Cedar Inc.'s name. The role descriptor, here IDPSSODescriptor, says it acts as an identity provider for single sign-on, and WantAuthnRequestsSigned says it expects signed requests. The KeyDescriptor with use="signing" holds the certificate whose public key verifies its signatures. Each endpoint pairs a binding with a location, as SAML bindings showed.

The training service's metadata has the same shape with an SPSSODescriptor instead:

xml
<md:SPSSODescriptor AuthnRequestsSigned="true" WantAssertionsSigned="true"
    protocolSupportEnumeration="urn:oasis:names:tc:SAML:2.0:protocol">
  <md:KeyDescriptor use="signing">...</md:KeyDescriptor>
  <md:KeyDescriptor use="encryption">...</md:KeyDescriptor>
  <md:AssertionConsumerService index="0" isDefault="true"
      Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST"
      Location="https://training.example/saml/acs"/>
</md:SPSSODescriptor>

AuthnRequestsSigned says the training service signs its requests, with the key in its own signing KeyDescriptor. WantAssertionsSigned asks Cedar Inc. to sign assertions. The encryption key is the one Cedar Inc. would use for an encrypted assertion. The ACS list is the full set of addresses where Cedar Inc. may deliver responses.

A certificate carries a public key

SAML metadata almost always wraps each public key in an X.509 certificate, but uses it differently from a website. A browser checking https://login.cedar.example walks the server's certificate up to a certificate authority it trusts and checks dates and names, as Validating a certificate showed. A SAML service provider usually does none of that. Cedar Inc.'s signing certificate is often self-signed, and what matters is the public key inside it: the training service trusts that key because it came through the agreement, not because a certificate authority vouched for it.

That has a practical consequence. Many SAML implementations ignore the certificate's expiry date, so an "expired" signing certificate can keep working for years. Others enforce the date and break on the day it passes. The two organizations should know which kind they run, because it decides whether a certificate's end date is a deadline or merely a reminder.

The key in the metadata is public. Cedar Inc. keeps the matching private key, often in a hardware security module, the protected key storage from Storing and using keys. Whoever holds that private key can write assertions any service provider will accept for any of Cedar Inc.'s users, which is why its protection matters more than almost any other secret Cedar Inc. has.

Metadata you can trust

The training service's administrator fetches Cedar Inc.'s metadata from https://login.cedar.example/saml/metadata. HTTPS proves the document came from that host, but not that the host is the one Cedar Inc. meant, or that whoever controls it is entitled to name signing keys. A metadata URL quietly changed in a configuration, or a compromised web server, would hand the training service an attacker's key.

Metadata therefore needs its own trust path. One is a careful first exchange: the administrators confirm the certificate's fingerprint over a separate channel before importing it. Another is signed metadata: the EntityDescriptor carries an XML signature from a key the receiver already trusts. Large federations, such as those connecting universities, publish one signed aggregate holding thousands of entity descriptors, and each member checks the federation's signature before using any of them.

validUntil sets a hard end: after 12 November 2026, this document must not be used. cacheDuration suggests how often to fetch a fresh copy, here daily. A receiver that refreshes metadata automatically should check the signature on every copy, keep the last good one if a fetch fails, and stop when validUntil passes rather than trusting stale keys forever.

Changing the signer without breaking everyone

Cedar Inc. plans to replace its signing key. If it simply switched to a new key one morning, every service provider still holding the old certificate would refuse every sign-in. The safe order adds the new key to the trust before anyone uses it:

StageCedar Inc. signs withThe training service trusts
BeforeOld keyOld key
PublishOld keyOld and new keys
SwitchNew keyOld and new keys
RetireNew keyNew key

To publish, Cedar Inc. adds a second KeyDescriptor use="signing" to its metadata. Every service provider must take in the new key, whether by refreshing metadata or by an administrator's change, before Cedar Inc. switches. How long that takes is the hard part: a federation that refreshes daily needs a day or two, while a partner who pins certificates by hand may need weeks of notice. After the switch, the old key stays trusted long enough for responses already in flight to finish, a few minutes, and then Cedar Inc. removes it, and service providers remove it too.

An identity provider's signing key rollover: publish the new key, wait until every receiver trusts it, switch, then retire the old one.

The service provider's own keys

The training service has keys too, and their safe order is different because the roles are reversed.

Its encryption key is used by Cedar Inc. to encrypt assertions, and by the training service to decrypt them. Here the training service must be ready first. It generates the new key pair and makes sure its software can decrypt with both old and new private keys. Only then does it publish the new public key in its metadata. Cedar Inc. starts encrypting to the new key whenever it refreshes, which the training service cannot control, so it keeps decrypting with the old key until it is sure no response encrypted to it can still arrive, and only then removes the old key from its metadata and deletes it.

Its request-signing key follows the identity provider's pattern instead, because now the training service is the signer. It publishes the new certificate alongside the old one, waits until Cedar Inc. trusts both, switches to signing requests with the new key, and retires the old certificate. Mixing up the two orders is a common cause of outages: an SP that publishes a new encryption key before it can decrypt with it breaks every sign-in the moment the IdP refreshes.

Expiry and compromise need different responses

A planned rollover has time for overlap. A compromised private key does not. If Cedar Inc.'s signing key leaked, anyone holding it could sign assertions for any user, so the old key must leave every service provider's trust at once, even if some sign-ins fail while the new key spreads. Cedar Inc. would also need to work out which sessions were opened with forged assertions, which no signature check can tell after the fact. Extending a certificate's end date, or issuing a new certificate for the same key, does nothing to repair a compromise.

For any change, keep a record of what changed and when: the certificate fingerprints, which side published what, and when each receiver confirmed it trusts the new key. Then test both directions. A response signed with the new key should be accepted, and once the old key is retired, a response signed with it should be refused. A rollover that never tests the refusal has not finished.

Check your understanding

Try these questions before moving on. If an answer isn't right, use the feedback and try again.

The training service is replacing its encryption key. What must be true before it publishes the new public key in its metadata? 1 of 3

Choose one answer.

Cedar Inc. wants to switch to a new signing key. Which order keeps every sign-in working? 2 of 3

Choose one answer.

Cedar Inc. learns that its SAML signing private key was copied from a backup. Its operator proposes the usual rollover with a two-week overlap. What should happen instead? 3 of 3

Choose one answer.

Try it in the Lab

We value your privacy

We use cookies and similar technologies to enhance your browsing experience, and analytics to understand our traffic. By clicking "Allow all", you consent to optional analytics. Cookie Policy

Learn identity