Join our Newsletter — 33% off our NHI Course
Home› FAQ› Authentication, Authorisation & Trust› How does a Security Token Service work?
Authentication, Authorisation & Trust

How does a Security Token Service work?

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

A Security Token Service issues security tokens after authenticating a requester and evaluating what claims or attributes to include. Those tokens let systems consume identity or authorisation information without repeatedly checking the original source. Defenders should protect token signing keys, restrict token lifetimes, and verify audience, issuer and scope to prevent token replay or privilege abuse.

How a Security Token Service fits into trust flows

A security token service sits between a requester and the systems that rely on its identity or claims. Instead of every application re-checking the original source, the STS becomes the trusted place that authenticates the requester, decides what attributes belong in the token, and issues a signed artefact that downstream systems can validate locally.

The practical value is standardisation. Different applications may trust the STS more consistently than they trust every upstream credential source, directory, or federation partner, which makes the STS a policy enforcement point as much as a token factory.

When the STS is used for delegation or on-behalf-of access, the token can express who the original subject is, who is acting, and what the acting party is allowed to do. That is why token exchange is often paired with audience restriction and explicit scope narrowing rather than broad bearer reuse.

What the STS evaluates before issuing a token

Issuance is not just a signing step. The STS must confirm the requester, determine the intended audience, and decide which claims, scopes, or attributes are appropriate for the target service. That evaluation is what prevents a valid requester from receiving a token that is valid everywhere or carries more privilege than the use case needs.

Audience, issuer, expiry, and scope are the core checks downstream systems should enforce. If those fields are loose, a token can be replayed outside its intended context, accepted by the wrong service, or used longer than the original trust decision intended.

For delegation patterns, the STS also needs a clean boundary between the original actor and the intermediary. The token should make the chain of delegation understandable to the consuming service, especially when the caller is not the final human or workload that benefits from the access.

Why token design and validation determine whether the STS is safe

An STS improves security only when the issued token is harder to misuse than the original credential path. Signed tokens reduce repeated authentication overhead, but they also concentrate risk in the signing keys and in any token that escapes its intended boundary. The most common failures are overbroad claims, overly long lifetimes, weak audience checks, and acceptance of tokens outside the issuing trust boundary.

Current good practice is to treat the token as a limited representation of trust, not as a reusable password. That means keeping lifetimes short where possible, binding tokens to the right client or transport when the architecture supports it, and making downstream verification strict rather than forgiving.

Readers who want the delegation mechanics behind this pattern should start with RFC 8693: OAuth 2.0 Token Exchange, which defines how one token can be exchanged for another in on-behalf-of and delegation scenarios.

Risk and Threat Considerations

STS designs tend to fail at the boundary between issuance and reuse. If signing keys are exposed, token lifetimes are excessive, or audience and issuer checks are weak, an attacker can replay a stolen token or expand access beyond the original trust decision.

Failure mechanism: The service issues a token that is valid too broadly, remains valid too long, or is accepted without strict validation, allowing token theft, replay, or privilege abuse to succeed after the original authentication event.

Impact: A compromised or misissued token can become a portable access artefact that bypasses repeated authentication, enables lateral movement across services, and turns a single trust failure into broad downstream exposure.

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 NIST SP 800-53 Rev 5 and NIST SP 800-57 set the governance and control requirements practitioners need to meet.

FrameworkControl / ReferenceRelevance
NIST SP 800-53 Rev 5IA-5 — Authenticator ManagementSTS token lifetimes, rotation and protection depend on credential and token lifecycle control.
IA-9 — Service Identification and AuthenticationSTS issues and validates tokens for service-to-service trust and delegated access flows.
AC-6 — Least PrivilegeSTS token claims and scopes should be minimized to the access actually needed.
Recommendation — Manage token and signing-key lifecycles tightly and revoke or rotate exposed credentials promptly. Authenticate services strongly and bind issued tokens to the intended service context. Limit token scopes and claims to the minimum access required for the transaction.
OWASP API Security Top 10API2 — Broken AuthenticationToken issuance and validation are core authentication controls for API-facing trust flows.
API5 — Broken Function Level AuthorizationSTS scopes and claims determine which functions a token may invoke downstream.
Recommendation — Harden token validation and reject tokens that are expired, misbound, or issued outside trust. Map token scopes to functions precisely and deny surplus privileges by default.
NIST SP 800-57Key ManagementSTS security depends on safeguarding token-signing keys and their lifecycle.
Recommendation — Protect signing keys with strong lifecycle controls and rotate them when exposure is suspected.

Practitioner Guidance

What to verify: Confirm that the STS enforces issuer, audience, expiry, and scope checks in both issuance and consumption paths. The issuing side and the validating side must agree on the trust boundary, or the token becomes an unaudited portable credential.

What to prioritise: Protect the token signing keys first, then reduce token lifetime and limit claim content to what the consuming service truly needs. If a token can be replayed to more than one service, or if it can outlive the session that justified it, the architecture is too permissive.

Practitioner takeaway: An STS is safest when it narrows trust at issuance and preserves that narrowness at validation, because the control fails the moment tokens become reusable outside the exact context they were minted for.

Free weekly newsletter

Subscribe to the NHI & AI Identity Journal

The latest on NHI and Agentic AI security – articles, research, breaches, news and events every week.

Bonus 33% off our NHI Course when you subscribe.

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