Skip to content

Fortified IDDocs

SAMLSP

Configuration reference for the SAMLSP authenticator.

The SAMLSP authenticator lets a Fortified ID web application act as a SAML 2.0 Service Provider (SP).

  • HTTP POST binding for authentication requests and responses
  • Unsigned authentication requests
  • Signed SP metadata and logout requests
  • SP-initiated and IdP-initiated single logout over HTTP POST
  • A single trusted IdP through metadata, or multiple trusted IdPs through trust_settings
  • SAML discovery when more than one trusted IdP is available

Configure SAMLSP in the authenticators list of an AuthN module. The application and authenticator must use the same HTTP listener and URI authority (host and port) so that they share the authentication session.

NameDescriptionDefaultMandatory
context_pathAssertion Consumer Service route. Metadata and logout endpoints are exposed below this path.""true
success_locationRedirect target after successful authentication when no completion location or return URL is available.""false
failure_locationRedirect target after failed authentication.""false
metadata_file_pathPath to the SP metadata template. Expressions in the globals scope are expanded before parsing.""true
metadata_output_directoryDirectory where generated SP metadata is written as <authenticator id>.xml at startup."."false
entity_idSP entity ID. Overrides the entity ID in the metadata template.Value from templatefalse
sign_refSigning-key configurations used for SP metadata and logout requests.[]true
metadataSingle-IdP metadata source. Configure either metadata.path or metadata.url.{}false
trust_settingsMulti-IdP trust configuration. Use instead of metadata.{}false
metadata_cacheDirectory used to cache IdP metadata loaded through metadata.url."."false
internal_http_destinationInternal HTTP client destination used to retrieve metadata.url."default"false
logout_locationFallback post-logout destination when the application has not stored a destination in the session.""false
force_authnAdds ForceAuthn="true" to generated authentication requests.falsefalse
validate_in_response_toRequires the response InResponseTo value to match the pending request ID.falsefalse
validate_audience_restrictionsRequires the SP entity ID to appear in the assertion's audience restrictions.falsefalse
validate_destinationRequires the response destination to match an Assertion Consumer Service in the SP metadata.falsefalse
validate_authn_instantValidates assertion AuthnInstant values.falsefalse
validate_session_timestampValidates assertion SessionNotOnOrAfter values.falsefalse
require_authn_contextRequires an AuthnContextClassRef and validates it against allowed_authn_context_class_ref.falsefalse
allowed_authn_context_class_refAccepted AuthnContextClassRef URIs. Also adds RequestedAuthnContext to authentication requests.[]false
authn_context_comparisonRequested authentication-context comparison: exact, minimum, maximum, or better."exact"false
skew_time_secondsAllowed clock skew for timestamp validation, in seconds.60false

Configure exactly one source of trusted IdP metadata: metadata.path, metadata.url, or a non-empty trust_settings object.

At least one entry in sign_ref is required. SAMLSP uses a successfully loaded credential to sign generated SP metadata and logout requests.

NameDescriptionDefaultMandatory
keystore.pathPath to a PKCS#12 keystore. Use either path or data.""false
keystore.dataBase64-encoded PKCS#12 data. Use either data or path.""false
keystore.passwordKeystore password.""true
keystore.aliasAlias of the signing key. If omitted, the first keystore alias is used.First aliasfalse
keystore.key_passwordPrivate-key password.Value of passwordfalse

At startup, SAMLSP reads the template from metadata_file_path, expands expressions from the globals scope, applies the configured entity_id, adds signing and logout information, and signs the resulting metadata. It writes the generated metadata to <metadata_output_directory>/<authenticator id>.xml.

The same metadata is available over HTTP at <context_path>/metadata. For example, a context_path of /portal/authn/login exposes metadata at /portal/authn/login/metadata.

Restart the module after changing the metadata template.

Use metadata.path to load an IdP EntityDescriptor from a local file, or metadata.url to retrieve it over HTTP. Metadata retrieved over HTTP is stored in metadata_cache. If a later retrieval fails, SAMLSP attempts to use the cached copy.

Use trust_settings to load and filter metadata for multiple IdPs. Add one or more local metadata files to trust_settings.path; each file can contain either an EntityDescriptor or an EntitiesDescriptor.

NameDescriptionDefaultMandatory
pathList of local metadata files to load.[]true
discovery_urlSAML IdP Discovery Service URL used when more than one trusted IdP remains.""false
allow_only_entityidCase-insensitive allowlist of IdP entity IDs. When non-empty, only listed IdPs are trusted.[]false
reject_entityidCase-insensitive denylist of IdP entity IDs. Rejection takes precedence over the allowlist.[]false
idp_exportStatic session and global-state values selected by source IdP.[]false

When discovery is used, the SP metadata template must contain an IdP Discovery DiscoveryResponse extension. SAMLSP sends the extension's location to the discovery service as the return URL. The discovery service returns the selected IdP entity ID in the providerid query parameter.

The following checks are always performed:

  • The response issuer is present in the configured trust registry.
  • The response or at least one assertion has a valid signature.
  • The response status is successful.
  • The response IssueInstant is valid within skew_time_seconds.
  • Assertion NotBefore and NotOnOrAfter timestamps are valid within skew_time_seconds.
  • The assertion issuer is present.

Use the optional validation properties to enable checks for InResponseTo, destination, audience restrictions, AuthnInstant, SessionNotOnOrAfter, and authentication context.

When allowed_authn_context_class_ref contains one or more values, generated authentication requests include RequestedAuthnContext. Returned AuthnContextClassRef values are compared with this list without regard to case.

Set require_authn_context to true to reject responses that do not contain an AuthnContextClassRef. Configure at least one allowed value when enabling this requirement.

{
"require_authn_context": true,
"allowed_authn_context_class_ref": [
"urn:oasis:names:tc:SAML:2.0:ac:classes:Password",
"urn:oasis:names:tc:SAML:2.0:ac:classes:SmartcardPKI"
],
"authn_context_comparison": "minimum"
}

After successful validation, every SAML assertion attribute is copied to the session. FriendlyName is used as the property name when present; otherwise, Name is used. An attribute with one value is stored as a string, while an attribute with multiple values is stored as an array. The assertion issuer is stored in source_idp.

Entries in trust_settings.idp_export add configured static values to both the session and the global authenticator state when source_idp matches the entry's entityid.

The logout route is <context_path>/logout. If the selected IdP metadata contains a Single Logout Service, SAMLSP sends a signed logout request to the IdP. It also accepts IdP-initiated logout requests over HTTP POST.

After logout, an application destination stored in the session takes precedence over logout_location. During local logout without an IdP Single Logout Service, the optional next query parameter is accepted only if its value starts with /.

Use the attached file as a minimal SP metadata template.

spmeta_template.xml