For AI agents: the complete documentation index is available at /llms.txt, the full documentation bundle is available at /llms-full.txt, and this page is available as Markdown at /specs/saml.md.

SAML

Overview

Security Assertion Markup Language (SAML) 2.0 is an XML-based authentication protocol that enables single sign-on (SSO) between identity providers (IdPs) and service providers (SPs). It allows users to access multiple applications using a single set of credentials by securely exchanging authentication data between systems.

Profiles

Edupass supports key SAML 2.0 specifications, including the Web Browser SSO profile and the Single Logout (SLO) profile. The SSO profile enables users to log in once to access multiple related applications without re-entering credentials, making it the most common SAML flow for web applications. It defines how SAML assertions are exchanged between the IdP and SP to authenticate users. The SLO profile defines the corresponding process for terminating user sessions across the IdP and all related SPs. Both flows are mediated through the user’s web browser.

The following sequence diagrams provide a step-by-step breakdown of the SAML 2.0 Web Browser SSO and SLO flows using HTTP POST binding, where SAML assertions are transmitted via HTML forms. Key steps in these diagrams are elaborated below.

Single sign-on flow

SAML 2.0 single sign-on sequence

Info

Entra ID’s SAML requests do not strictly follow the standard SAML XML structure. For example, Entra ID places the default XML namespace as urn:oasis:names:tc:SAML:2.0:metadata instead of urn:oasis:names:tc:SAML:2.0:protocol. We will align with Entra ID’s XML format going forward so that integrations remain consistent and easier to maintain.

[1] Generate AuthnRequest

This is the first step of the SP-initiated flow. The Service Provider creates a SAML AuthnRequest message. This is an XML-based request that essentially asks the Identity Provider to authenticate the user and send back an assertion.

Info
  • AuthnRequest Signature (Optional): If enabled, Edupass will accept only signed requests. If not enabled, the requester is still verified because Edupass responds only to registered Assertion Consumer Service URLs.

Here is an example of AuthnRequest element generated by the Service Provider.

<samlp:AuthnRequest
  xmlns="urn:oasis:names:tc:SAML:2.0:metadata"
  ID="_b93fbda9e4c749eeb3c7e9adbe2c8884"
  Version="2.0"
  IssueInstant="2013-03-18T03:28:54.1839884Z"
  xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol">
  <Issuer xmlns="urn:oasis:names:tc:SAML:2.0:assertion">your-app-entity-id</Issuer>
  <NameIDPolicy Format="urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified" />
</samlp:AuthnRequest>
NameTypeRequired?Description
IDAttributeRequiredEdupass uses this attribute to populate the InResponseTo attribute of the returned response. ID must not begin with a number, so a common strategy is to prepend a string like "ID" to the string representation of a GUID.
VersionAttributeRequiredThis attribute should be set to 2.0.
IssueInstantAttributeRequiredThis is a DateTime string with a UTC value and round-trip format ("o").
IssuerElementRequiredThis element uniquely identifies your SP (the “Entity ID”), it must match the SP entity ID declared in the submitted onboarding form.
NameIDPolicyElementRequiredThe Format attribute of this element should be explicitly set to urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified. This ensures that the <NameID> value in the <Subject> element corresponds to the user’s Edupass Identifier.
If the Format attribute is set to any other value, the correctness of the <NameID> value cannot be relied on, as Edupass does not guarantee its immutability or consistency across sessions.
AssertionConsumerServiceURLAttributeOptionalThe SP endpoint where Edupass should POST the SAML Response.
IsPassiveAttributeOptionalThis is a boolean value that specifies whether Edupass should authenticate the user silently, without user interaction, using the session cookie if one exists. If this is true, Edupass attempts to authenticate the user using the session cookie.
ForceAuthnAttributeNot RecommendedThis is a boolean value, if true, forces the user to re-authenticate even with a valid Edupass session, preventing single sign-on login to the SP.

[2] Redirects to the IdP SAML 2.0 Endpoint

The SAML Web SSO flow begins with the Service Provider redirecting the user to Edupass's SAML 2.0 SSO endpoint to request authentication.

Here is an example of the Service Provider redirecting the user to the Identity Provider for SAML authentication.

HTTP/1.1 302 Found
Location: https://login.microsoftonline.com/{tenant}/saml2?SAMLRequest={saml-request}&RelayState={relay-state}
ParameterDescription
tenantThe ID of the Edupass Entra ID tenant.
- Preprod: 97f42547-72fd-4d98-b89a-e39375923893
- Prod: 342e7f12-abca-4f63-9a52-ce093487bbc1
SAMLRequestBase64-encoded deflated AuthnRequest XML message.
RelayStateA RelayState parameter should be included in the SAML authentication request. Edupass returns this value unchanged in the HTTP POST containing the SAML Response. The specific RelayState value is up to the SP but must not exceed 80 bytes in length. This value should be used to encode the CSRF token, a secret and unpredictable value. The SP should validate that the CSRF token returned in the RelayState is the same as the value set in the original request to prevent CSRF attacks.

[3] SAML Response POST to Service Provider’s ACS endpoint

The SAML Web SSO flow concludes with the Identity Provider posting the authentication response to the Service Provider's Assertion Consumer Service (ACS) endpoint.

Info

Ensure the AssertionConsumerServiceURL matches the RP’s registered ACS endpoint.

Here is an example of a SAML Response POST from the IdP to the Service Provider's ACS endpoint.

POST /saml/acs HTTP/1.1
Host: my-app.example.com
Content-Type: application/x-www-form-urlencoded

SAMLResponse=<saml-response>&RelayState={relay-state}
ParameterDescription
SAMLResponseBase64-encoded deflated Response XML message.
RelayStateEnsure this is the same as the value sent in [2] Redirects to the IdP SAML 2.0 Endpoint.
SAML Response XML Schema

Here is an example of a SAMLResponse element generated by the Identity Provider after a successful sign-on.

<samlp:Response
    ID="_response123456"
    Version="2.0"
    IssueInstant="2026-03-02T06:00:00Z"
    Destination="https://my-app.example.com/saml/acs"
    InResponseTo="_b93fbda9e4c749eeb3c7e9adbe2c8884"
    xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol">

    <Issuer xmlns="urn:oasis:names:tc:SAML:2.0:assertion">
      https://sts.windows.net/2aef017b-0afb-47d9-a1ab-23148b712d37/
    </Issuer>

    <samlp:Status>
        <samlp:StatusCode Value="urn:oasis:names:tc:SAML:2.0:status:Success"/>
    </samlp:Status>

    <Assertion
        ID="_assertion789"
        IssueInstant="2026-03-02T06:00:00Z"
        Version="2.0"
        xmlns="urn:oasis:names:tc:SAML:2.0:assertion">

        <Issuer>https://sts.windows.net/2aef017b-0afb-47d9-a1ab-23148b712d37/</Issuer>

        <Signature xmlns="http://www.w3.org/2000/09/xmldsig#">
            <SignedInfo>
                <CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
                <SignatureMethod Algorithm="http://www.w3.org/2001/04/xmldsig-more#rsa-sha256"/>
                <Reference URI="#_assertion789">
                    <Transforms>
                        <Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"/>
                        <Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
                    </Transforms>
                    <DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"/>
                    <DigestValue>VZe2PbhLThUOUO6ab7DEzUN7b/8cGCUhYUtlpkcYE6I=</DigestValue>
                </Reference>
            </SignedInfo>
            <SignatureValue>
                eERraF/LqY0F7pk/wuuaFYY7B9ufFNt1Cedu51TbjbBW1w2ex0TAfGPi...
            </SignatureValue>
            <KeyInfo>
                <X509Data>
                    <X509Certificate>
                        MIIC8DCCAdigAwIBAgIQQRJvakygo6BEm7tqQX7y6TANBgkqhkiG9w0B...
                    </X509Certificate>
                </X509Data>
            </KeyInfo>
        </Signature>

        <Subject>
            <NameID Format="urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified">
                000012345678
            </NameID>
            <SubjectConfirmation Method="urn:oasis:names:tc:SAML:2.0:cm:bearer">
                <SubjectConfirmationData
                    InResponseTo="_b93fbda9e4c749eeb3c7e9adbe2c8884"
                    NotOnOrAfter="2026-03-02T06:10:00Z"
                    Recipient="https://my-app.example.com/saml/acs"/>
            </SubjectConfirmation>
        </Subject>

        <Conditions NotBefore="2026-03-02T06:00:00Z"
                    NotOnOrAfter="2026-03-02T07:00:00Z">
            <AudienceRestriction>
                <Audience>https://my-app.example.com/saml/metadata</Audience>
            </AudienceRestriction>
        </Conditions>

        <AttributeStatement>

            <Attribute Name="http://schemas.edupass.moe.gov.sg/identity/claims/id">
                <AttributeValue>000012345678</AttributeValue>
            </Attribute>

            <Attribute Name="http://schemas.edupass.moe.gov.sg/identity/claims/identitytype">
                <AttributeValue>Staff</AttributeValue>
            </Attribute>

            <Attribute Name="http://schemas.edupass.moe.gov.sg/identity/claims/name">
                <AttributeValue>John Tan</AttributeValue>
            </Attribute>

            <Attribute Name="http://schemas.edupass.moe.gov.sg/identity/claims/uinfin">
                <AttributeValue>S0000001I</AttributeValue>
            </Attribute>

            <Attribute Name="http://schemas.edupass.moe.gov.sg/identity/claims/schoolorhq">
                <AttributeValue>School</AttributeValue>
            </Attribute>

            <Attribute Name="http://schemas.edupass.moe.gov.sg/identity/claims/title">
                <AttributeValue>Teacher</AttributeValue>
            </Attribute>

            <Attribute Name="http://schemas.edupass.moe.gov.sg/identity/claims/notificationemail">
                <AttributeValue>john_tan@schools.gov.sg</AttributeValue>
            </Attribute>

            <Attribute Name="http://schemas.edupass.moe.gov.sg/identity/claims/wogemail">
                <AttributeValue>john_tan@moe.gov.sg</AttributeValue>
            </Attribute>

            <Attribute Name="http://schemas.edupass.moe.gov.sg/identity/claims/cesemail">
                <AttributeValue>john_tan@schools.gov.sg</AttributeValue>
            </Attribute>

            <Attribute Name="http://schemas.edupass.moe.gov.sg/identity/claims/iconemail">
                <AttributeValue>john_tan@moe.edu.sg</AttributeValue>
            </Attribute>

            <Attribute Name="http://schemas.edupass.moe.gov.sg/identity/claims/identitysource">
                <AttributeValue>HRPS</AttributeValue>
            </Attribute>

            <Attribute Name="http://schemas.microsoft.com/ws/2008/06/identity/claims/groups">
                <AttributeValue>1730_AE_admin</AttributeValue>
                <AttributeValue>1731_AE_user</AttributeValue>
            </Attribute>

        </AttributeStatement>

        <AuthnStatement AuthnInstant="2026-03-02T06:00:00Z"
                        SessionIndex="00220eda-823e-0889-c17e-3c68acc55b82">
            <AuthnContext>
                <AuthnContextClassRef>
                    urn:oasis:names:tc:SAML:2.0:ac:classes:Unspecified
                </AuthnContextClassRef>
            </AuthnContext>
        </AuthnStatement>

    </Assertion>
</samlp:Response>

Here is an example of a SAMLResponse element generated by the Identity Provider after an unsuccessful sign-on.

<samlp:Response

    ID="_response123456"
    Version="2.0"
    IssueInstant="2025-11-11T12:30:00Z"
    Destination="https://my-app.example.com/saml/acs"
    InResponseTo="_b93fbda9e4c749eeb3c7e9adbe2c8884"
    xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol">

    <Issuer xmlns="urn:oasis:names:tc:SAML:2.0:assertion">
      https://sts.windows.net/{TenantGUID}/
    </Issuer>

    <samlp:Status>
        <samlp:StatusCode
            Value="urn:oasis:names:tc:SAML:2.0:status:Responder">
            <samlp:StatusCode
                Value="urn:oasis:names:tc:SAML:2.0:status:AuthnFailed"/>
        </samlp:StatusCode>
        <samlp:StatusMessage>
            Authentication failed: invalid username or password.
        </samlp:StatusMessage>
    </samlp:Status>
</samlp:Response>
Note

Not all attributes and elements shown in the example SAML messages are listed in the table below. Many of these additional elements and attributes are defined in the official SAML 2.0 specification but do not carry significance in the exchange between Edupass and the SP. They are included in examples for completeness and to remain standards-compliant, but Edupass does not require or process them for normal SSO or SLO flows.

NameTypeDescription
DestinationAttributeWhen sign on completes successfully, this is set to the RedirectUri of the service provider (cloud service).
InResponseToAttributeThis is set to the ID attribute of the <AuthnRequest> element that initiated the response.
Issuer
(Same applies to the element under <Response> and <Assertion>)
ElementThis is set to https://sts.windows.net/{TenantIDGUID}/ or https://login.microsoftonline.com/<TenantIdGUID>/ where {TenantIDGUID} is the tenant ID of the Edupass Entra ID tenant. The tenant IDs are respectively:
- Pre-prod: 97f42547-72fd-4d98-b89a-e39375923893
- Prod: 342e7f12-abca-4f63-9a52-ce093487bbc1
StatusCodeElementIt contains a code or a set of nested codes that represents the status of the request.
StatusMessageElementIt contains custom error messages that are generated during the sign-on process.
SignatureElementContains a digital signature that the cloud service can use to authenticate the source to verify the integrity of the assertion. See below for more info.
SubjectElementIt contains a <NameID> element, the value of which corresponds to the NameIDPolicy that was set in the AuthnRequest.
ConditionsElementThe NotBefore and NotOnOrAfter attributes specify the interval during which the assertion is valid.
AudienceElementThis is set to the value of <Issuer> element of the AuthnRequest that initiated the sign-on.
AttributeStatementElementThis contains claims about the subject or user, see User Schema section for reference.
The attribute names will follow the format of http://schemas.edupass.moe.gov.sg/identity/claims/<claimname>
AuthnStatementElementThis asserts that the assertion subject was authenticated by a particular means at a particular time.
- The AuthnInstant attribute specifies the time at which the user authenticated with Microsoft Entra ID.
- The <AuthnContext> element specifies the authentication context used to authenticate the user.
Info

We recommend that SPs enable assertion encryption

To support assertion encryption, SP must provide its SAML encryption certificate during onboarding. This allows Edupass to encrypt the SAML assertion, ensuring that sensitive user attributes (e.g., NRIC, names, email addresses) are protected through persistent, selective confidentiality as defined by XML Encryption. Without assertion encryption, these attributes would appear in plain text within the browser’s POST body and could be exposed to:

  • Browser plugins
  • Server or proxy logs
  • Intermediaries

Encryption details:

  • The SAML assertion in the response is encrypted using the SP’s encryption certificate provided during onboarding.
  • The <EncryptedAssertion> element replaces <Assertion> entirely with ciphertext.
  • The SP must use its private key to decrypt the assertion before validating the signature and processing user attributes.

Example element:

<EncryptedAssertion>
    <xenc:EncryptedData Type="http://www.w3.org/2001/04/xmlenc#Element">
        ...
    </xenc:EncryptedData>
</EncryptedAssertion>

[4] Validate SAML Response

For the authentication response, applications should:

  • Ensure the <Issuer> matches the expected Entra ID entity ID i.e. https://sts.windows.net/{tenant-id}/
  • Validate InResponseTo matches the ID of the AuthnRequest that was sent.
  • Validate that the <Signature> is from Edupass (see Signature Validation).
  • Validate <Audience> matches the Issuer in the AuthnRequest.
  • Validate <Conditions> (NotBefore, NotOnOrAfter) are current.
  • Validate Recipient in <SubjectConfirmationData> matches the ACS URL and is still valid.
  • Validate assertions are received over TLS.
Signature Validation

Edupass always signs the SAML Response. It is the Service Provider’s (SP’s) responsibility to validate this signature to ensure integrity and authenticity.

To validate the signature:

  1. Obtain the public key for Edupass via the federation metadata document endpoint.

    https://login.microsoftonline.com/<TENANT-ID>/federationmetadata/2007-06/federationmetadata.xml

    This endpoint returns the public keys (taken from the X509Certificate below):

    <KeyDescriptor use="signing">
      <KeyInfo xmlns="http://www.w3.org/2000/09/xmldsig#">
        <X509Data>
          <X509Certificate>
            MIIC8DCCAdigAwIBAgIQQRJvakygo6BEm7tqQX7y6TANBgkqhkiG9w0B...
          </X509Certificate>
        </X509Data>
      </KeyInfo>
    </KeyDescriptor>
    Note
    • As the signing keys will rotate periodically, there could be more than 1 certificate provided during the rollover period. All provided certificates are valid and the SP should support all certificates in the document.
    • The SP should refresh the federation metadata at least once every 24 hours to detect newly published or removed signing certificates. The SP should not hard-code or rely on a single signing certificate. During a certificate rollover, the SP should continue to accept the existing signing certificate while also accepting the newly published certificate. This allows the certificate rotation to take place without interrupting SAML authentication.
  2. The SAMLResponse contains the key used to generate the signature, in Assertion → Signature → KeyInfo → X509Data → X509Certificate. Check that this key exists in the metadata document in (1).

    <KeyInfo>
        <X509Data>
            <X509Certificate>
                MIIC8DCCAdigAwIBAgIQQRJvakygo6BEm7tqQX7y6TANBgkqhkiG9w0B...
            </X509Certificate>
        </X509Data>
    </KeyInfo>
  3. Verify the signature provided, with the key in (2). This can be found in Assertion → Signature → SignatureValue.

    <Signature xmlns="http://www.w3.org/2000/09/xmldsig#">
        ...
        <SignatureValue>
            eERraF/LqY0F7pk/wuuaFYY7B9ufFNt1Cedu51TbjbBW1w2ex0TAfGPi...
        </SignatureValue>

Single Logout flow

SAML 2.0 single logout sequence

Note

For consistency and session integrity, the Service Provider must trigger Microsoft Entra ID’s Single Logout flow to properly terminate the user’s session across all federated applications. The Service Provider should not perform logout locally within the application without calling Edupass SLO endpoint.

[1] Generate Logout Request

The Service Provider creates a LogoutRequest message. This is an XML-based request that asks the Identity Provider to log the user out from all SPs in the session. Here is an example of LogoutRequest element generated by the Service Provider.

<samlp:LogoutRequest xmlns="urn:oasis:names:tc:SAML:2.0:metadata"
  ID="idaa6ebe6839094fe4abc4ebd5281ec780"
  Version="2.0"
  IssueInstant="2013-03-28T07:10:49.6004822Z"
  xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol">
  <Issuer xmlns="urn:oasis:names:tc:SAML:2.0:assertion">your-app-entity-id</Issuer>
  <NameID xmlns="urn:oasis:names:tc:SAML:2.0:assertion">000012345678</NameID>
</samlp:LogoutRequest>
NameTypeRequired?Description
IDAttributeRequiredMicrosoft Entra ID uses this attribute to populate the InResponseTo attribute of the returned response. ID must not begin with a number, so a common strategy is to prepend a string like "ID" to the string representation of a GUID.
VersionAttributeRequiredThis parameter should be set to 2.0.
IssueInstantAttributeRequiredThis is a DateTime string with a UTC value and round-trip format ("o").
IssuerElementRequiredUniquely identifies your SP (the “Entity ID”), it must match the SP entity ID declared in the onboarding metadata submitted.
NameIDElementRequiredThis should exactly match the NameID of the user that is being signed out.

[2] Redirects to the SAML 2.0 Single Sign-out URL

The SAML Single Logout (SLO) flow begins with the Service Provider redirecting the user to the Identity Provider’s SAML 2.0 logout endpoint to terminate the user’s session.

Here is an example of the Service Provider redirecting the user to Microsoft Entra ID for SAML logout.

HTTP/1.1 302 Found
Location: https://login.microsoftonline.com/{tenant}/saml2?SAMLRequest={saml-logout-request}&RelayState={relay-state}
ParameterDescription
tenantThe ID of the Edupass Entra ID tenant.
- Preprod: 97f42547-72fd-4d98-b89a-e39375923893
- Prod: 342e7f12-abca-4f63-9a52-ce093487bbc1
SAMLRequestBase64-encoded deflated LogoutRequest XML message.
RelayStateA RelayState parameter should be included in the SAML logout request. Edupass returns this value unchanged in the HTTP GET containing the SAML Response. The specific RelayState value is up to the SP but must not exceed 80 bytes in length. This value should be used to encode the CSRF token, a secret and unpredictable value. The SP should validate that the CSRF token returned in the RelayState is the same as the value set in the original request to prevent CSRF attacks.

[3] Send LogoutResponse to the Logout URL

Microsoft Entra ID sends a LogoutResponse in reply to a LogoutRequest, and the browser forwards this response via an HTTP GET to the SP’s SAML logout endpoint. Here is an example of such a request.

GET /saml/logout?SAMLResponse=<saml-logout-response>&RelayState={relay-state} HTTP/1.1
Host: my-app.example.com
ParameterDescription
SAMLResponseBase64-encoded deflated LogoutResponse XML message.
RelayStateEnsure this is the same as the value sent in [2] Redirects to the SAML 2.0 Single Sign-out URL.

The following shows a sample LogoutResponse XML message.

<samlp:LogoutResponse ID="_f0961a83-d071-4be5-a18c-9ae7b22987a4"
  Version="2.0"
  IssueInstant="2013-03-18T08:49:24.405Z"
  InResponseTo="idaa6ebe6839094fe4abc4ebd5281ec780"
  xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol">
  <Issuer xmlns="urn:oasis:names:tc:SAML:2.0:assertion">https://sts.windows.net/{TenantIDGUID}/</Issuer>
  <samlp:Status>
    <samlp:StatusCode Value="urn:oasis:names:tc:SAML:2.0:status:Success" />
  </samlp:Status>
</samlp:LogoutResponse>
NameTypeDescription
VersionAttributeThis parameter should be set to 2.0.
IssueInstantAttributeThis is a DateTime string with a UTC value and round-trip format ("o").
InResponseToAttributeThis is set to the ID attribute of the <LogoutRequest> element that initiated the response.
IssuerElementThis is set to https://sts.windows.net/{TenantIDGUID}/ or https://login.microsoftonline.com/<TenantIdGUID>/ where {TenantIDGUID} is the tenant ID of the Microsoft Entra tenant.
- Preprod: 97f42547-72fd-4d98-b89a-e39375923893
- Prod: 342e7f12-abca-4f63-9a52-ce093487bbc1
StatusCodeElementIt contains a code or a set of nested codes that represents the status of the request.

References