Join our Newsletter — 33% off our NHI Course
Home› FAQ› Authentication, Authorisation & Trust› How should teams design SSO when an application…
Authentication, Authorisation & Trust

How should teams design SSO when an application needs to support both SP-initiated and IdP-initiated flows?

← Back to all FAQ
By NHI Mgmt Group Editorial Team Updated September 26, 2026 Domain: Authentication, Authorisation & Trust

Teams should design SSO around a trusted identity boundary, not around a single login path. The application must validate every assertion from the identity provider, confirm the issuer is trusted, and handle both redirect patterns consistently. That usually means normalizing token handling, mapping users reliably, and testing the login journey from discovery through session creation.

Design the SSO boundary before you design the login path

Supporting both SP-initiated and IdP-initiated SSO is mostly a question of boundary design. The application should treat the identity provider as a trusted issuer, but never as a blind source of truth. That means the app must validate the assertion or token, verify issuer and audience, and create the same internal session state regardless of which flow started the login.

In practice, the safest design is to make the application’s session creation logic flow-agnostic. Whether the user arrives from a service-provider redirect or an identity-provider launch, the app should end up in one canonical authentication pipeline. That reduces divergence in authorization checks, account linking, and post-login state handling.

For implementations based on OpenID Connect, the protocol already separates authentication from the browser entry path, which is why a common token-processing layer is the right place to converge the two journeys. The same applies when a SAML assertion is involved: the app still has to validate the response, bind it to the right local user, and avoid assuming that the entry point itself proves trust.

The OpenID Connect Core 1.0 specification is useful here because it formalises the difference between authentication results and the route a user took to reach them.

The same design discipline is reflected in NHIMG’s Identity Provider and SSO Security Guide, which focuses on federation trust, assertion validation, token security, and session handling.

Make user mapping and session creation deterministic

The most common failure mode in dual-flow SSO is not the redirect itself, it is inconsistent identity mapping. If SP-initiated login resolves a user by one attribute set and IdP-initiated login resolves the same person by another, teams get duplicate accounts, broken role assignment, or unintended access inheritance.

A robust design uses one authoritative mapping strategy and one post-authentication session model. The application should decide how it links the external identity to the local account, how it handles first login, and how it applies roles or entitlements after assertion validation. That mapping logic should not vary by entry path.

This is also where session hygiene matters. If the app allows IdP-initiated login, it should still establish a fresh application session, reject stale browser state, and avoid carrying over context from a previous unauthenticated visit. The point is to make both flows produce the same authenticated state, not two subtly different ones.

For teams standardising the wider identity surface around SSO and federation, NHIMG’s Workforce Identity Security Guide is a useful companion because it covers federation, session theft, and account lifecycle controls that sit around the login journey.

NHIMG’s IAM and Identity Provider Buyer’s Guide also helps when the real issue is choosing an IdP or validating that the platform can support consistent SSO behaviour across both initiation patterns.

Test both journeys, not just the happy path

Teams often verify SP-initiated SSO thoroughly and then assume IdP-initiated login is just a mirror image. It is not. The redirect sequence, RelayState handling, application landing page, and account discovery behaviour can all differ in ways that create broken login, weak error handling, or unexpected access to the wrong tenant or environment.

The right test plan exercises discovery, redirect, assertion validation, account resolution, session creation, logout, and re-login for both directions. It should also confirm that the application rejects unsigned, malformed, replayed, or issuer-mismatched assertions, and that failure behaviour is consistent and observable across both flows.

For protocol-level verification, OWASP ASVS is a good fit because it covers authentication, session management, and access control requirements that should hold regardless of the SSO entry path.

For implementation teams that want to validate the browser flow itself, the OWASP Web Security Testing Guide gives a practical structure for testing authentication and session behaviour in a way that exposes flow-specific defects.

Risk and Threat Considerations

Dual-flow SSO increases the chance that one path is hardened while the other is treated as a convenience feature. That creates real exposure if teams trust IdP-initiated assertions too broadly, fail to enforce issuer and audience checks, or let session creation vary by entry point.

Failure mechanism: An attacker or misconfigured integration can abuse inconsistent validation, stale browser state, or weak account mapping to impersonate a user, bind the wrong local account, or land in an unintended session context.

Impact: The result can be account takeover, cross-tenant access, privilege misassignment, or a login experience that appears to succeed while silently attaching the user to the wrong internal identity.

Standards & Framework Alignment

This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.

OWASP API Security Top 10 addresses the attack and risk surface, while OWASP ASVS and NIST SP 800-53 Rev 5 set the governance and control requirements practitioners need to meet.

FrameworkControl / ReferenceRelevance
OWASP ASVSV6 — AuthenticationSSO flows hinge on authentication handling and assertion validation.
V7 — Session ManagementThe answer depends on creating one consistent authenticated session after either flow.
V8 — AuthorizationUser mapping and role application after SSO directly affect access decisions.
Recommendation — Verify both SSO entry paths enforce the same authentication checks and trusted issuer rules. Ensure both flows create the same session state and reject stale or replayed sessions. Bind external identities to local accounts before applying authorization decisions.
OWASP API Security Top 10API2 — Broken AuthenticationImproper token or assertion validation in SSO can break authentication trust.
Recommendation — Validate issuer, audience, and signature checks before accepting any login assertion.
NIST SP 800-53 Rev 5IA-2 — Identification and Authentication (Organizational Users)Workforce SSO must identify and authenticate users consistently across both flows.
Recommendation — Require the same identity proof and authentication assurance for both SSO entry paths.

Practitioner Guidance

What to verify: Confirm that both flows reach the same assertion-validation code path, the same user-linking logic, and the same session-creation routine. If they do not, treat that as a design defect rather than an edge case.

Common mistake: Teams often test only whether the user can log in, not whether the application consistently enforces issuer trust, audience binding, and account identity under both initiation patterns.

Practitioner takeaway: The safest SSO design is the one where the entry path can change, but the trust decision and internal session outcome cannot.

Deepen Your Knowledge

Sign up to our weekly newsletter — get 33% off our NHI Foundation Level Course

    NHIMG Editorial Note
    Reviewed and updated by the NHIMG editorial team on September 26, 2026.
    NHI Mgmt Group — the #1 independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org