What service provider metadata is for
In SAML, the app is the service provider. Before an identity provider will sign users in to it, the identity provider must know three things: the app’s entity id, where to send responses, and which certificate the app uses. Service provider metadata is a standard XML document that carries all three, defined in the SAML 2.0 metadata specification.
Most identity providers can import it, which saves typing URLs and certificates into a console by hand and avoids the typos that come with it. Many SAML libraries generate it for you; this tool is for when yours does not, or when you want to see exactly what goes in it.
What goes in it
<md:EntityDescriptor entityID="https://app.example.com/saml/metadata">
<md:SPSSODescriptor AuthnRequestsSigned="true" WantAssertionsSigned="true"
protocolSupportEnumeration="urn:oasis:names:tc:SAML:2.0:protocol">
<md:KeyDescriptor use="signing">
<ds:KeyInfo><ds:X509Data>
<ds:X509Certificate>MIICsDCCAZgCCQ…</ds:X509Certificate>
</ds:X509Data></ds:KeyInfo>
</md:KeyDescriptor>
<md:SingleLogoutService
Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect"
Location="https://app.example.com/saml/logout"/>
<md:NameIDFormat>urn:oasis:names:tc:SAML:2.0:nameid-format:persistent</md:NameIDFormat>
<md:AssertionConsumerService index="0" isDefault="true"
Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST"
Location="https://app.example.com/saml/acs"/>
</md:SPSSODescriptor>
</md:EntityDescriptor>Entity id
A URI that names the app. It is compared as an exact string everywhere: in requests as the Issuer, in assertions as the Audience, and at the identity provider as the app’s identifier. Using the metadata URL itself is a common choice because it is unique and easy to find.
Assertion consumer service
The URL where the app receives SAML responses, with a binding. For browser sign-in that is HTTP-POST, or HTTP-Artifact if the app resolves artifacts. The index and isDefault attributes let an app list more than one.
Single logout service
Optional. The URL where the app receives logout requests and responses, if it supports single logout.
NameID format
Optional. The identifier formats the app accepts. If you list one, the identity provider knows what to send. See the NameID format reference.
Keys and flags
A signing certificate lets the identity provider check signed requests. An encryption certificate lets it encrypt assertions for the app. AuthnRequestsSigned says the app signs its requests; WantAssertionsSigned says the app wants signed assertions.
Element order matters
The metadata schema fixes the order of elements inside SPSSODescriptor: keys first, then single logout services, then NameID formats, then assertion consumer services. Some importers are strict about this and reject documents in another order. The tool always writes the schema order.
What this tool does
Fill in the entity id, ACS URL and binding, an optional logout URL and binding, a NameID format, the two signing flags and an optional certificate. The tool writes the metadata as you type. It checks that URLs are absolute, that the certificate is Base64 and reads as X.509, and that signed requests come with a certificate. It warns about plain http endpoints.
It escapes every value for XML, wraps the certificate in a KeyDescriptor with use="signing", and can publish the same certificate for encryption too.
What it does not do
It does not sign the metadata, generate keys, or add organization and contact details. It never asks for a private key: metadata only ever holds public certificates. To make a key pair for testing, use the RSA key pair generator and keep the private key with the app.
How to use it
- Decide the app’s entity id. Once an identity provider has it, changing it is a migration.
- Enter the ACS URL the app listens on, exactly as the browser will reach it, with
https. - Add the logout URL if the app supports single logout.
- Pick the NameID format the app expects, or none.
- Tick the flags that match the app, paste its public certificate, and copy the XML.
- Host the file at a stable URL, or send it to the identity provider’s administrator.
Use cases
Registering an app in Keycloak
Keycloak can create a SAML client from service provider metadata. In the admin console, open Clients and choose Import client, then load the file. The entity id becomes the client id, and settings such as the ACS and logout URLs and the signing certificate are taken from the metadata. Check the result before you save, then give the app the realm descriptor URL in return.
Onboarding with an enterprise customer
When you sell an app to a company that uses its own identity provider, their administrator usually asks for your metadata. Generate one document per environment, such as staging and production, each with its own entity id and URLs, so the two never get mixed up.
Moving an app to a new domain
A domain move changes the ACS and logout URLs, and often the entity id. To move without downtime, publish metadata that lists both ACS URLs, with the new one as default, and have the identity provider import it. Switch the app to the new domain, then remove the old URL. If the entity id changes too, the identity provider sees a new app: register it next to the old one and switch users over in one step.
Testing a new SAML integration
Before the app’s SAML library is wired up, you can register its metadata at a test identity provider, then use the SAML redirect URL builder to send a request and the SAML response decoder to read what comes back.
Common mistakes
- An ACS URL that differs from what the app checks, such as
httpbehind a TLS proxy or a missing path prefix. - Different entity ids in the metadata and in the app’s configuration.
- Pasting a private key instead of the certificate.
- Setting
AuthnRequestsSignedwithout giving a certificate. - Reusing one entity id for staging and production.
Security notes
Metadata is public. It should hold only public certificates, never keys or secrets. Serve it over https so nobody can change the ACS URL or certificate on the way to the identity provider. If the identity provider requires signed metadata, sign it with your own tooling after generating it.
Best practices
- Use https for every endpoint.
- Sign requests and ask for signed assertions.
- Use separate keys for signing and encryption if your library supports it.
- Publish the metadata at a stable URL so the identity provider can refresh it.
- List only the bindings and formats the app really supports.
Hosting the metadata
Identity providers that refresh metadata need a stable URL to fetch it from. Serve the file from the app itself or a static host, over https, with the content type application/samlmetadata+xml or plain application/xml. Many teams make the entity id and the metadata URL the same string, so anyone holding the entity id can find the metadata.
Keep the URL public and unauthenticated. The file contains only public information, and an identity provider cannot sign in to fetch it. When you change a certificate or an endpoint, change the hosted file first, then tell the identity provider’s administrator so they can refresh it if their side does not do so on its own.
More than one ACS URL
An app can list several AssertionConsumerService elements, for example one per binding or one per host name during a domain move. Each has an index, a number unique within the descriptor, and one may be marked isDefault="true".
A request can then pick one, either by URL with AssertionConsumerServiceURL or by number with AssertionConsumerServiceIndex. Without either, the identity provider uses the default, or the first one listed. This tool writes one endpoint with index 0 as the default; add more by hand if you need them, keeping each index unique.