Subscribe to the Non-Human & AI Identity Journal
Authentication, Authorisation & Trust

Session Model

← Back to Glossary
By NHI Mgmt Group Updated June 7, 2026 Domain: Authentication, Authorisation & Trust

The session model is the way an application remembers that a user or client has already authenticated. In Python systems, this may be stateless JWTs, server-side database sessions, or Redis-backed sessions. The choice affects revocation, auditability, and how much control security teams retain after login.

Expanded Definition

The session model describes how an application maintains authentication state after initial login, but the implementation choices are not interchangeable. Stateless JWT sessions push trust into the token itself, while server-side sessions in a database or Redis let operators revoke access, inspect active state, and enforce policy changes centrally. For NHI and agentic systems, this distinction matters because a session can represent a human user, a service account, or an AI Agent with tool access. Industry usage is still evolving, and no single standard governs this yet, so teams should distinguish “authentication token format” from “session control model.” NIST’s NIST Cybersecurity Framework 2.0 is useful here because it frames identity as an operational control problem, not just a login event. A strong session model also needs to align with offboarding, token expiry, and incident response, which is why NHIMG treats session design as a governance decision rather than a purely technical preference. The most common misapplication is treating a long-lived JWT as a harmless session, which occurs when teams cannot revoke access quickly after credential compromise or role change.

Examples and Use Cases

Implementing the session model rigorously often introduces revocation and state-management overhead, requiring organisations to weigh operational simplicity against tighter control over active access.

  • A web app uses Redis-backed sessions so security teams can terminate access immediately after suspicious behavior is detected, rather than waiting for token expiry.
  • A Python API issues stateless JWTs for short-lived machine interactions, but pairs them with strict expiry, audience validation, and refresh controls to reduce replay risk.
  • An AI Agent authenticates through a session tied to a tool gateway, allowing operators to inspect which actions occurred under the current execution context.
  • A service account is moved from long-lived cookies to server-side sessions so access can be revoked during rotation events documented in the Ultimate Guide to NHIs.
  • A platform team follows identity and access guidance from the NIST Cybersecurity Framework 2.0 to ensure session handling supports least privilege and recovery workflows.

These patterns often appear in Python frameworks, but the same underlying question remains: who can invalidate the session, and how quickly does that change take effect across distributed services?

Why It Matters in NHI Security

Session design directly affects how much control remains after authentication, which is critical when a compromised NHI can continue to call APIs, access secrets, or trigger automation. NHIMG research shows that only 5.7% of organisations have full visibility into their service accounts, making it difficult to know which active sessions still matter during a response. The session model therefore influences auditability, containment, and whether revocation is actually enforceable in practice. A stateless design can be fast and scalable, but it can also delay recovery if tokens cannot be centrally invalidated. A stateful design can support tighter oversight, but it adds infrastructure and coordination requirements across services. This is why session architecture should be reviewed alongside the Ultimate Guide to NHIs and mapped to operational identity controls in the NIST Cybersecurity Framework 2.0. Organisations typically encounter the real cost of a weak session model only after a token leak or service account abuse, at which point revocation becomes operationally unavoidable to address.

Standards & Framework Alignment

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

OWASP Non-Human Identity Top 10 address the attack and risk surface, while NIST CSF 2.0 and NIST Zero Trust (SP 800-207) set the governance and control requirements practitioners need to meet.

FrameworkControl / ReferenceRelevance
OWASP Non-Human Identity Top 10NHI-02Session state determines how long stolen NHI credentials remain usable.
NIST CSF 2.0PR.AC-4Identity and access permissions must be enforced across active sessions.
NIST Zero Trust (SP 800-207)JIT / continuous verificationSession trust should be continually re-evaluated under Zero Trust principles.

Use short-lived, verifiable sessions and re-check trust before each privileged action.

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