Skip to content

SAML Reference

Complete reference for BlokSec’s SAML 2.0 Identity Provider implementation. For a step-by-step integration guide, see the SAML Quickstart.

https://api.bloksec.io
GET /sso/metadata/{applicationId}
Content-Type: text/xml

Returns the SAML 2.0 IdP metadata XML for the specified application. The {applicationId} is the application’s DID, shown on the application detail page in the admin console.

The metadata includes:

ElementValue
EntityIDBlokSec issuer URL
SingleSignOnServicePOST binding to /sso/SingleSignOnService/{applicationId}
SingleLogoutServicePOST binding to /sso/SingleLogoutService/{applicationId}
KeyDescriptor (signing)X.509 certificate for assertion signature verification
NameIDFormatConfigured formats for this application
GET|POST /sso/SingleSignOnService/{applicationId}

The SAML Single Sign-On endpoint. Accepts both SP-initiated (with AuthnRequest) and IdP-initiated flows.

  1. Your SP generates a SAML AuthnRequest and redirects (or posts) the user to this endpoint
  2. BlokSec renders the login page
  3. The user authenticates using their BlokSec app
  4. BlokSec generates a signed SAML response and posts it to your ACS URL

If the user navigates directly to BlokSec and selects your application, BlokSec generates an unsolicited SAML response and posts it to your ACS URL.

GET|POST /sso/SingleLogoutService/{applicationId}

The SAML Single Logout endpoint. Accepts logout requests to terminate the user’s BlokSec session.

BlokSec generates SAML 2.0 assertions with the following structure:

<saml:Subject>
<saml:NameID Format="{configured format}">{NameID value}</saml:NameID>
<saml:SubjectConfirmation Method="urn:oasis:names:tc:SAML:2.0:cm:bearer">
<saml:SubjectConfirmationData
NotOnOrAfter="{issue time + 5 minutes}"
Recipient="{your ACS URL}"
InResponseTo="{AuthnRequest ID}" />
</saml:SubjectConfirmation>
</saml:Subject>
<saml:Conditions NotBefore="{issue time}" NotOnOrAfter="{issue time + 5 minutes}">
<saml:AudienceRestriction>
<saml:Audience>{your SP Entity ID}</saml:Audience>
</saml:AudienceRestriction>
</saml:Conditions>

Assertions are valid for a 5-minute window from the time of issue.

<saml:AuthnStatement AuthnInstant="{auth time}" SessionIndex="{session ID}">
<saml:AuthnContext>
<saml:AuthnContextClassRef>
urn:oasis:names:tc:SAML:2.0:ac:classes:PasswordProtectedTransport
</saml:AuthnContextClassRef>
</saml:AuthnContext>
</saml:AuthnStatement>

If custom attributes are configured, they are included as:

<saml:AttributeStatement>
<saml:Attribute Name="{attribute name}"
NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:basic">
<saml:AttributeValue xsi:type="xs:string">{value}</saml:AttributeValue>
</saml:Attribute>
</saml:AttributeStatement>
FormatURI
Email Addressurn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress
Persistenturn:oasis:names:tc:SAML:2.0:nameid-format:persistent
Transienturn:oasis:names:tc:SAML:2.0:nameid-format:transient
Unspecifiedurn:oasis:names:tc:SAML:1.1:nameid-format:unspecified

The default format is emailAddress.

The NameID value comes from the NameID Source configured on the application:

SourceValue
Account NameThe user’s account name (identifier within the application)
User EmailThe user’s email address

All SAML responses and assertions are signed by BlokSec using the application’s signing certificate. The certificate is included in the IdP metadata.

If Require Signed Requests is enabled on the application, BlokSec will reject any AuthnRequest that is not signed by the SP. This provides additional assurance that the request came from the legitimate SP.

Assertion encryption is not currently enabled. Assertions are signed but transmitted in plaintext within the SAML response. Use HTTPS to protect assertions in transit.

If authentication fails, BlokSec returns a SAML response with a non-success status code:

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

Common failure reasons:

  • User denied the authentication request
  • Authentication request timed out (120-second default)
  • User’s account is suspended or terminated