API

SAML metadata reference

ulex's SAML 2.0 metadata documents in full: IdP metadata for relying parties, SP metadata for upstream IdPs, every element, every binding, every ulex extension, and how to read the entityID, ACS and SLO URLs.

Two documents, both EntityDescriptor, both served as application/samlmetadata+xml.

DocumentEndpointConsumed byCredential
IdP metadataGET /api/v1/applications/{id}/metadatayour relying partynone
IdP metadata for a connectionGET /api/v1/connections/{id}/saml/metadataulex, as an SPnone

Both are public documents. IdPs fetch them with no credential, so they are unrate-limited and must never contain anything secret.

#1. ulex as IdP — your relying party consumes this

bash
curl -sS "$BASE/applications/app_01M3PSV7J8TBSPHG95CYSEX32B/metadata"
xml
<?xml version="1.0" encoding="UTF-8"?>
<EntityDescriptor xmlns="urn:oasis:names:tc:SAML:2.0:metadata"
                  entityID="https://ulexid.com/api/v1/applications/app_01M3PSV7J8TBSPHG95CYSEX32B"
                  validUntil="2027-03-11T00:00:00Z">
  <ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
    <ds:SignedInfo>
      <ds:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
      <ds:SignatureMethod Algorithm="http://www.w3.org/2001/04/xmldsig-more#rsa-sha256"/>
      <ds:Reference URI="">
        <ds:DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"/>
        <ds:DigestValue>j2K0m1sT5yP9rB3kD6fG1aH0mNqU4wE7iO2pL5xC8vB1nMg==</ds:DigestValue>
      </ds:Reference>
    </ds:SignedInfo>
    <ds:SignatureValue>8JmQ1vZ0Xh4n7cW2sT5yP9rB3kD6fG1aH0mNqU4wE7iO2pL5xC8vB1nMg0jKhR3t…</ds:SignatureValue>
    <ds:KeyInfo>
      <ds:X509Data><ds:X509Certificate>MIIDQjCCAiqgAwIBAgIGATz/FuLiMA0GCSqGSIb3DQ…</ds:X509Certificate></ds:X509Data>
    </ds:KeyInfo>
  </ds:Signature>

  <IDPSSODescriptor WantAuthnRequestsSigned="false"
                    protocolSupportEnumeration="urn:oasis:names:tc:SAML:2.0:protocol">
    <KeyDescriptor use="signing">
      <ds:KeyInfo xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
        <ds:X509Data><ds:X509Certificate>MIIDQjCCAiqgAwIBAgIGATz/FuLi…</ds:X509Certificate></ds:X509Data>
      </ds:KeyInfo>
    </KeyDescriptor>

    <NameIDFormat>urn:oasis:names:tc:SAML:2.0:nameid-format:persistent</NameIDFormat>

    <SingleSignOnService Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect"
                         Location="https://ulexid.com/api/v1/auth/app_01M3PSV7J8TBSPHG95CYSEX32B/sso"/>
    <SingleSignOnService Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST"
                         Location="https://ulexid.com/api/v1/auth/app_01M3PSV7J8TBSPHG95CYSEX32B/sso"/>

    <SingleLogoutService Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect"
                         Location="https://ulexid.com/api/v1/auth/app_01M3PSV7J8TBSPHG95CYSEX32B/slo"/>
    <SingleLogoutService Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST"
                         Location="https://ulexid.com/api/v1/auth/app_01M3PSV7J8TBSPHG95CYSEX32B/slo"/>

    <AttributeConsumingService index="1">
      <ServiceName xml:lang="en">Acme Support</ServiceName>
      <ServiceDescription xml:lang="en">ulex SAML identity provider for Acme Support</ServiceDescription>
      <RequestedAttribute Name="email" NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:basic" isRequired="1"/>
      <RequestedAttribute Name="firstName" NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:basic" isRequired="0"/>
      <RequestedAttribute Name="lastName" NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:basic" isRequired="0"/>
      <RequestedAttribute Name="displayName" NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:basic" isRequired="0"/>
      <RequestedAttribute Name="title" NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:basic" isRequired="0"/>
      <RequestedAttribute Name="department" NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:basic" isRequired="0"/>
      <RequestedAttribute Name="groups" NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:basic" isRequired="0"/>
      <RequestedAttribute Name="org_id" NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:basic" isRequired="1"/>
      <RequestedAttribute Name="org_slug" NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:basic" isRequired="0"/>
      <RequestedAttribute Name="org_role" NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:basic" isRequired="0"/>
      <RequestedAttribute Name="sid" NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:basic" isRequired="0"/>
      <RequestedAttribute Name="auth_time" NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:basic" isRequired="0"/>
      <RequestedAttribute Name="amr" NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:basic" isRequired="0"/>
    </AttributeConsumingService>
  </IDPSSODescriptor>

  <Organization>
    <OrganizationName xml:lang="en">ulex</OrganizationName>
    <OrganizationDisplayName xml:lang="en">ulex</OrganizationDisplayName>
    <OrganizationURL xml:lang="en">https://ulexid.com</OrganizationURL>
  </Organization>

  <ContactPerson contactType="technical">
    <GivenName>ulex</GivenName>
    <SurName>Support</SurName>
    <EmailAddress>support@ulexid.com</EmailAddress>
  </ContactPerson>
</EntityDescriptor>

#Element reference

ElementMeaning
@entityIDthe stable identifier. https://ulexid.com/api/v1/applications/{applicationId}. Also the default expected Issuer in every assertion and the default expected Audience you should check yours against
@validUntilwhen the document must be re-fetched. Currently one year from the signing certificate's issue date
@cacheDurationabsent. Fetch at least daily
@IDPSSODescriptor/@WantAuthnRequestsSignedfalse. ulex does not require signed AuthnRequests from SPs
KeyDescriptor[@use="signing"]the certificate that signs assertions. Refresh from GET /applications/{id}/secret; it rotates with the tenant signing keys
NameIDFormatpersistent. The NameID is the ulex usr_… id and does not change when the user's email does
SingleSignOnServicetwo bindings, same Location. Redirect is preferred; POST is available for IdPs that cannot do Redirect
SingleLogoutServicetwo bindings, same Location
AttributeConsumingServicewhat ulex emits, and which attributes your SP should request. email and org_id are isRequired="1"
Organizationstatic. Not per-tenant
ContactPersonstatic support contact. Not a real inbox

#Bindings

BindingURNulex endpoint
HTTP-Redirecturn:oasis:names:tc:SAML:2.0:bindings:HTTP-RedirectGET /api/v1/auth/{appId}/sso
HTTP-POSTurn:oasis:names:tc:SAML:2.0:bindings:HTTP-POSTPOST /api/v1/auth/{appId}/sso
HTTP-Artifacturn:oasis:names:tc:SAML:2.0:bindings:HTTP-Artifactnot supported
SOAPurn:oasis:names:tc:SAML:2.0:bindings:SOAPnot supported

If a customer's IdP only offers Artifact or SOAP, it cannot federate. Say so early.

#ulex metadata extensions

These are not part of any SAML specification. They appear in the namespace https://ulexid.com/saml/metadata.

xml
<ulex:DeploymentEnvironment xmlns:ulex="https://ulexid.com/saml/metadata">prod</ulex:DeploymentEnvironment>
<ulex:OrganizationSlug xmlns:ulex="https://ulexid.com/saml/metadata">acme</ulex:OrganizationSlug>
<ulex:MockSso xmlns:ulex="https://ulexid.com/saml/metadata">true</ulex:MockSso>
<ulex:SupportsSingleLogout xmlns:ulex="https://ulexid.com/saml/metadata">true</ulex:SupportsSingleLogout>
ExtensionValuesUse
DeploymentEnvironmentprod (or local dev in npx @ulexid/mcp-server)identifies the issuing control-plane environment
OrganizationSlugthe slugdisplay only
MockSsotrue | falsea mock_sso connection is a simulator. If an SP checks this, it can refuse to federate on non-mock workloads
SupportsSingleLogouttrue | falseavoids a half-configured SLO

Ignoring unknown-namespace elements is required of every conformant SP. Do not make your SP reject ulex's metadata for containing extensions.

#2. ulex as SP — the customer's IdP metadata

bash
curl -sS "$BASE/connections/con_01M3PSVY108K5TEHHQ82WN30YK/saml/metadata"
xml
<?xml version="1.0" encoding="UTF-8"?>
<EntityDescriptor xmlns="urn:oasis:names:tc:SAML:2.0:metadata"
                  entityID="https://globex.okta.com/app/exk9r2mz1hRtXQ2N5s0d7"
                  validUntil="2027-04-18T00:00:00Z">
  <ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#">…</ds:Signature>
  <IDPSSODescriptor WantAuthnRequestsSigned="false"
                    protocolSupportEnumeration="urn:oasis:names:tc:SAML:2.0:protocol">
    <KeyDescriptor use="signing">
      <ds:KeyInfo xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
        <ds:X509Data><ds:X509Certificate>MIIE1DCCA3CgAwIBAgIULSJ…</ds:X509Certificate></ds:X509Data>
      </ds:KeyInfo>
    </KeyDescriptor>
    <NameIDFormat>urn:oasis:names:tc:SAML:2.0:nameid-format:persistent</NameIDFormat>
    <NameIDFormat>urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress</NameIDFormat>
    <SingleSignOnService Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect"
                         Location="https://globex.okta.com/app/exk9r2mz1hRtXQ2N5s0d7/sso/saml"/>
    <SingleSignOnService Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST"
                         Location="https://globex.okta.com/app/exk9r2mz1hRtXQ2N5s0d7/sso/saml"/>
    <SingleLogoutService Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect"
                         Location="https://globex.okta.com/app/exk9r2mz1hRtXQ2N5s0d7/slo/saml"/>
    <AttributeConsumingService index="0">
      <ServiceName xml:lang="en">Globex SSO</ServiceName>
      <RequestedAttribute Name="email"/>
      <RequestedAttribute Name="firstName"/>
      <RequestedAttribute Name="lastName"/>
      <RequestedAttribute Name="userId"/>
      <RequestedAttribute Name="groups"/>
    </AttributeConsumingService>
  </IDPSSODescriptor>
</EntityDescriptor>

This is the customer's document, normalised by ulex into the same shape. ulex does not verify the signature on an IdP metadata document; it does not need to, because the certificate in it is exactly what the connection was configured with. The security boundary is the connection's x509_certificate, not the metadata URL.

FieldMaps to
@entityIDconfig.saml.entity_id. Must equal the Issuer in signed assertions
KeyDescriptorconfig.saml.x509_certificate. Manually uploaded, not read from here
SingleSignOnServiceconfig.saml.sso_url. If the metadata lists several, the one matching config.saml.binding is used
SingleLogoutServiceconfig.saml.slo_url
NameIDFormatthe list ulex will accept. If the requested format is not in the connection's name_id_format, the assertion is 400 saml_response_invalid
AttributeConsumingServiceinformational. ulex maps by attribute_mapping, not by the customer's declared list
@validUntilsurfaced in POST /connections/{id}/verify as certificate_not_expired

#3. What ulex emits in an assertion

xml
<samlp:Response xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol"
                xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion"
                ID="_8JmQ1vZ0Xh4n7cW2sT5yP9rB3kD6fG1aH0mN"
                Version="2.0" IssueInstant="2026-09-29T14:45:12Z"
                Destination="https://app.example.com/saml/acs"
                InResponseTo="_4Kq9WmB2yLt7NxZ1pRc6HdE0sJg3AuV8">
  <saml:Issuer>https://ulexid.com/api/v1/applications/app_01M3PSV7J8TBSPHG95CYSEX32B</saml:Issuer>
  <samlp:Status><samlp:StatusCode Value="urn:oasis:names:tc:SAML:2.0:status:Success"/></samlp:Status>
  <saml:Assertion ID="_aH0mNqU4wE7iO2pL5xC8vB1nMg0jKhR3t"
                  Version="2.0" IssueInstant="2026-09-29T14:45:12Z">
    <saml:Issuer>https://ulexid.com/api/v1/applications/app_01M3PSV7J8TBSPHG95CYSEX32B</saml:Issuer>
    <saml:Subject>
      <saml:NameID Format="urn:oasis:names:tc:SAML:2.0:nameid-format:persistent">usr_01M3PSV9GRT8GQGEG686AR1W9S</saml:NameID>
      <saml:SubjectConfirmation Method="urn:oasis:names:tc:SAML:2.0:cm:bearer">
        <saml:SubjectConfirmationData NotOnOrAfter="2026-09-29T14:45:17Z"
                                     InResponseTo="_4Kq9WmB2yLt7NxZ1pRc6HdE0sJg3AuV8"
                                     Recipient="https://app.example.com/saml/acs"/>
      </saml:SubjectConfirmation>
    </saml:Subject>
    <saml:Conditions NotBefore="2026-09-29T14:45:07Z" NotOnOrAfter="2026-09-29T14:45:17Z">
      <saml:AudienceRestriction>
        <saml:Audience>https://app.example.com/saml/metadata</saml:Audience>
      </saml:AudienceRestriction>
    </saml:Conditions>
    <saml:AuthnStatement AuthnInstant="2026-09-29T14:45:12Z" SessionIndex="_s1x8Kq2WmB4yLt7">
      <saml:AuthnContext>
        <saml:AuthnContextClassRef>urn:ulex:acr:mfa</saml:AuthnContextClassRef>
      </saml:AuthnContext>
    </saml:AuthnStatement>
    <saml:AttributeStatement>
      <saml:Attribute Name="email"><saml:AttributeValue>dana@acme.example</saml:AttributeValue></saml:Attribute>
      <saml:Attribute Name="org_id"><saml:AttributeValue>org_01M3PSV8HGTKQFCAYF9GDWGN3C</saml:AttributeValue></saml:Attribute>
    </saml:AttributeStatement>
  </saml:Assertion>
</samlp:Response>
ElementValueYour SP must check
Response/@Destinationyour ACS URLyes, exactly
Response/@InResponseToyour AuthnRequest IDyes, unless the login was IdP-initiated
Response/Issuerthe metadata entityIDyes
Assertion/Subject/NameIDthe ulex usr_… idkey your user table on this
SubjectConfirmationData/@Recipientyour ACS URLyes
SubjectConfirmationData/@NotOnOrAfter+300 syes
Conditions/@NotBefore−300 syes
Conditions/@NotOnOrAfter+300 syes
AudienceRestriction/Audienceyour SP entity idyes
AuthnStatement/@AuthnInstantwhen they authenticatedfor your own session bookkeeping
SessionIndexthe ulex sessionfor SLO correlation
AuthnContextClassRefan urn:ulex:acr:* valuefor MFA policy
Assertion/@IDuniquereject a repeat

The assertion window is 5 minutes in both directions. A consumer configured to reject assertions older than 60 seconds will fail intermittently; that looks like flakiness and is a misconfiguration.

#4. Reading a document

bash
# The four values every integration needs, from the IdP metadata.
curl -sS "$BASE/applications/$APP_ID/metadata" \
  | xmllint --xpath 'concat(
      string(/*[local-name()="EntityDescriptor"]/@entityID), " ",
      string(//*[local-name()="SingleSignOnService"][1]/@Location), " ",
      string(//*[local-name()="SingleLogoutService"][1]/@Location), " ",
      string(//*[local-name()="NameIDFormat"][1])
    )' -
text
https://ulexid.com/api/v1/applications/app_01M3PSV7J8TBSPHG95CYSEX32B https://ulexid.com/api/v1/auth/app_01M3PSV7J8TBSPHG95CYSEX32B/sso https://ulexid.com/api/v1/auth/app_01M3PSV7J8TBSPHG95CYSEX32B/slo urn:oasis:names:tc:SAML:2.0:nameid-format:persistent
ts
// Or just let the library do it. Do not hand-roll a SAML parser.
import { Metadata } from "samlify";
const md = await Metadata.fromUrl(`${base}/api/v1/applications/${appId}/metadata`);
console.log(md.entityID, md.idpSsoDescriptor!.singleSignOnService![0]!.location);

#5. Certificate and rotation

bash
curl -sS "$BASE/applications/$APP_ID/secret" -H "Authorization: Bearer $ULEX_API_KEY" | jq -r '.saml_signing_certificate, .saml_signing_certificate_expires_at'

The certificate rotates with the tenant's signing keys. Cache it, and re-fetch on a schedule shorter than its lifetime.

ts
const CERT_TTL_MS = 7 * 24 * 60 * 60_000;   // 7 days; certs live a year
let cachedCert: { pem: string; fetchedAt: number } | null = null;

export async function ulexSamlCert(): Promise<string> {
  if (!cachedCert || Date.now() - cachedCert.fetchedAt > CERT_TTL_MS) {
    const res = await fetch(`${base}/api/v1/applications/${appId}/secret`, {
      headers: { Authorization: `Bearer ${process.env.ULEX_API_KEY!}` },
    });
    if (!res.ok) throw new Error(`ulex /applications/{id}/secret returned ${res.status}`);
    const body = (await res.json()) as { saml_signing_certificate: string };
    cachedCert = { pem: body.saml_signing_certificate, fetchedAt: Date.now() };
  }
  return cachedCert.pem;
}

A SP that pins a certificate in a config file breaks once a year. A SP that reads it from the metadata URL, or caches it with a short TTL, does not.

When the tenant's signing key rotates, ulex serves both certificates in KeyDescriptor for the grace window. Prefer a SP that accepts any KeyDescriptor in the document over one that indexes [1].

#6. Validating a document

bash
xmllint --noout <(curl -sS "$BASE/applications/$APP_ID/metadata") && echo "well-formed"
text
well-formed

If you verify the metadata's ds:Signature yourself, use RS256 with exclusive canonicalisation and a Reference URI="". ulex signs the document so you can detect a man-in-the-middle between you and ulex; it is not required by the SAML profile and many IdPs omit it.

#Reference