SurePassID Identity Provider
SAML2 web.config Settings & Caching Reference
This document describes the SAML2‑specific
appSettingskeys used by the SurePassID SAML2 IdP (SurePassIdp/web.config) and explains how the SAML request‑ID and session cache works.
1. SAML2‑Specific
appSettings
All keys live under <appSettings> in
SurePassIdp/web.config. Sensitive keys
(Saml.PersistentNameIdSalt, DB credentials, mail password,
etc.) should be encrypted following
Documentation/Setup/WebConfig-Encryption-Guide.md.
1.1 IdP Identity & URLs
| Key | Example | Purpose |
|---|---|---|
Server.AppId |
https://saml2.surepassid.com |
The IdP application identifier / entity context. Also consumed by the FIDO server helper.. Required — the FIDO server reports a config error if missing. |
System.IdpRootURL |
https://saml2.surepassid.com/ |
The public root URL of the IdP. Used to build endpoint URLs (SSO, SLO, metadata) that appear in generated metadata and responses. When empty, falls back to request‑derived URLs. |
System.Login2FAMethods |
SENDEMAIL,SENDSMS,SENDVOICE,PUSHAPP |
Comma‑delimited list of allowed 2FA delivery methods for the login flow. |
1.2 NameID Generation
| Key | Example | Purpose |
|---|---|---|
Saml.PersistentNameIdSalt |
your-secret-salt |
Secret salt used by SamlNameIdGenerator
(SurePassClassLib/Utility/SamlNameIdGenerator.cs) when
producing persistent NameIDs. Read through
SurePassConfiguration.GetAppSecrets(...), so it must be
stored as an encrypted secret. Precedence:
Saml.PersistentNameIdSalt → System.Salt →
built‑in default. Keep this stable; changing it changes every persistent
NameID and breaks existing SP account linkages. |
Note: In the shipped
web.configthis key is deliberately disabled by prefixing the key name withIGNORE.(IGNORE.Saml.PersistentNameIdSalt). Remove theIGNORE.prefix to activate a custom salt; otherwise the fallback chain applies.
1.3 Email Templates (password / account recovery)
| Key | Example | Purpose |
|---|---|---|
Saml2.AccountLoginInfoTemplateName |
ServicePass_AccountLoginInfo |
Template name used by the forgot‑password flow
(SurePassIdp/SAML/ForgotPassword.aspx.cs) to send
account/login information. |
Saml2.PasswordChangedTemplateName |
ServicePass_PasswordChanged |
Template name used by the change‑password flow
(SurePassIdp/ChangePassword.aspx.cs) to confirm a password
change. |
1.4 Diagnostic Tracing
| Key | Example | Purpose |
|---|---|---|
Server.Trace |
1 |
Master switch for diagnostic tracing (1 = on). Read in
SurePassIdp/ssoWebUtil.cs. |
Server.TracePath |
C:\temp |
Directory where trace output is written
(SurePassIdp/ssoUtil.cs). |
Saml2.TraceSensitiveData |
false |
When false (default), full SAML
request/response/assertion payloads and EAM request objects /
id_tokens (which contain PII and security tokens) are
suppressed from the trace log even when
Server.Trace is on. Set to true ONLY for
short‑term troubleshooting. Enforced in ssoUtil.cs
(GetConfigParameterBool("Saml2.TraceSensitiveData", false))
and honored by the EAM authorize/callback pages for parity. |
Security: Leave
Saml2.TraceSensitiveData=falsein production so logs cannot leak tokens or PII.
2. SAML Cache Settings
The IdP uses a cache for two purposes:
- Replay‑attack prevention — tracking SAML request IDs that have already been seen.
- Single Logout (SLO) support — tracking active SAML sessions so they can be located and terminated (per user, per SP, or per session index).
2.1 Configuration Keys
| Key | Default | Purpose |
|---|---|---|
SamlCache.Provider |
InMemory |
Selects the cache backend: InMemory (default) or
SqlServer. |
SamlCache.RequestIdExpirationMinutes |
5 |
How long a request ID is retained for replay detection. |
SamlCache.SessionExpirationHours |
8 |
How long an SAML session record is retained (used for SLO). |
Example:
<appSettings>
<!-- Cache provider: "InMemory" (default) or "SqlServer" -->
<add key="SamlCache.Provider" value="InMemory" />
<!-- Optional: Request ID expiration in minutes (default: 5) -->
<add key="SamlCache.RequestIdExpirationMinutes" value="5" />
<!-- Optional: Session expiration in hours (default: 8) -->
<add key="SamlCache.SessionExpirationHours" value="8" />
</appSettings>3. How Caching Works
3.1 Provider
Selection (SamlSessionCacheProvider)
SamlSessionCacheProvider.Instanceis a thread‑safe, lazily initialized singleton (double‑checked locking).- On first access it reads
SamlCache.Providerplus the two expiration keys viaGetConfigInt(...)(values must be positive integers; otherwise the default is used). - Behavior by provider value:
SqlServer→ constructsSqlServerSamlSessionCache(requestIdExpMinutes, sessionExpHours)(SurePassClassLib/Utility/SqlServerSamlSessionCache.cs), a durable, cross‑node cache backed by the schema inDocumentation/Development/Database/SamlSessionCache_Schema.sql.- Anything else / empty → uses the in‑memory cache.
The provider sets the static
SamlRequestIdCache.CacheExpirationandSamlRequestIdCache.SessionExpirationfrom config, then returns anInMemorySamlSessionCacheWrapperthat adapts the staticSamlRequestIdCacheto theISamlSessionCacheinterface.
SamlSessionCacheProvider.CurrentProviderNamereturns the effective provider name.Reset()andSetInstance(...)exist primarily for testing.
3.2 In‑Memory Cache
(SamlRequestIdCache)
Captures these metrics.
| Store | Type | Purpose |
|---|---|---|
_requestIds |
requestId → firstSeenTimestamp |
Replay detection. |
_sessions |
sessionIndex → SamlSessionInfo |
Primary session store. |
_userSessions |
userId → set<sessionIndex> |
"Logout all sessions" for a user. |
_spSessions |
spEntityId → set<sessionIndex> |
SP‑specific session queries. |
Tunable expirations (set from config by the provider):
CacheExpiration— request‑ID retention (default 5 min).SessionExpiration— session retention (default 8 hours).
3.3 SQL Server
Cache (SqlServerSamlSessionCache)
- Durable, shared across web‑farm nodes (the in‑memory cache is per‑process only).
- Uses the same
requestIdExpirationMinutes/sessionExpirationHoursvalues, passed as SQL parameters (@ExpirationMinutes,@ExpirationHours) so expiration is enforced in the database. - Requires the schema/table from
Documentation/Development/Database/SamlSessionCache_Schema.sql(seeDocumentation/Setup/Saml-Session-Cache-Setup.mdfor setup steps).
4. Choosing a Provider
| Scenario | Recommended Provider |
|---|---|
| Single IdP node / dev / test | InMemory (default) — simplest, no DB dependency. |
| Web farm / multiple nodes / SLO across nodes | SqlServer — shared, durable cache so replay detection
and SLO work consistently across all nodes. |
Important: With
InMemory, request‑ID and session state are not shared between nodes and are lost on app‑pool recycle. For any multi‑node or high‑availability deployment, useSqlServer.
5. Quick Reference — All SAML2 Keys
<!-- IdP identity & URLs -->
<add key="Server.AppId" value="https://saml2.surepassid.com" />
<add key="System.IdpRootURL" value="https://saml2.surepassid.com/" />
<add key="System.Login2FAMethods" value="SENDEMAIL,SENDSMS,SENDVOICE,PUSHAPP" />
<!-- NameID generation (store encrypted; remove IGNORE. prefix to activate) -->
<add key="Saml.PersistentNameIdSalt" value="your-secret-salt" />
<!-- Email templates -->
<add key="Saml2.AccountLoginInfoTemplateName" value="ServicePass_AccountLoginInfo" />
<add key="Saml2.PasswordChangedTemplateName" value="ServicePass_PasswordChanged" />
<!-- Diagnostic tracing -->
<add key="Server.Trace" value="1" />
<add key="Server.TracePath" value="C:\temp" />
<add key="Saml2.TraceSensitiveData" value="false" />
<!-- SAML cache -->
<add key="SamlCache.Provider" value="InMemory" />
<add key="SamlCache.RequestIdExpirationMinutes" value="5" />
<add key="SamlCache.SessionExpirationHours" value="8" />© 2013–2026 SurePassID. All rights reserved. Protected by patents pending. SurePassID, the SurePassID logo and design, and Secure SSO are registered trademarks or trademarks of SurePassID, Corp. in the United States and/or other jurisdictions. All other marks and names mentioned herein may be trademarks of their respective companies.
SurePassID 360 Central Avenue #800 St. Petersburg, FL 33701 USA +1 (888) 200-8144 surepassid.com