Authentication & Access · Study deck

Operating Access Control

Picture a service engineer who receives extra rights for a repair and closes the screen without signing out.

Shield Shelly is your guide for this deck.

access-controlsessionstoken-lifecycle
Shield Shelly, the module guide, in a scene from this chapter.
iotclass.org

After studying this chapter

Learning objectives

You will be able to:

  • Explain: A real system must keep deciding, continuously, as users log in and walk away, as tokens age out, as a device temporarily needs more rights and then gives them back, and as credentials are revoked.
  • Explain: A technician leaves a console open, a token leaks into a log file, a gateway needs emergency rights for five minutes, or a refresh token keeps minting new access after the human has gone home.
  • Explain: The client first proves its credentials to the authentication server, receives a signed token, and then presents that token to the API on each request.
iotclass.org

Major section

Overview: Access Control That Lives Over Time

The system must end those rights even if the person forgets.

  • A gateway means the boundary system that joins local devices to another network or service.
  • A login is not the end of the security story.
  • Operating access control is the discipline that keeps those ordinary events from becoming standing access.

Key terms

session
session is the server's record that a principal authenticated and is currently active.

Why it matters

This chapter is about access control as an ongoing process rather than a one-time check, and about layering several controls so that defeating any one of them is not enough.

iotclass.org

Major section

Overview: Access Control That Lives Over Time (continued)

“Security is not a wall, it’s a list of who can do what — and the proof that the list is enforced.”.

  • A technician leaves a console open, a token leaks into a log file, a gateway needs emergency rights for five minutes, or a refresh token keeps minting new access after the human has gone home.
  • Four moving parts carry that process.
  • Around all of it, audit records what happened.
iotclass.org

Major section

Overview: Access Control That Lives Over Time (continued)

A real system must keep deciding, continuously, as users log in and walk away, as tokens age out, as a device temporarily needs more rights and then gives them back, and as credentials are revoked.

  • In this chapter she audits time itself — every session, token, and elevated right must show when it expires and who can end it early.
  • A session is the server's record that a principal authenticated and is currently active.
  • If you only need the intuition, this layer is enough: a token is short-lived proof of a prior authentication, not a standing key to the kingdom.
iotclass.org

Major section

Overview: Access Control That Lives Over Time (continued)

They sign in (a session record), receive a badge that expires that evening (a token with an absolute timeout), and have it reclaimed if they wander off unaccompanied (an idle timeout).

  • A guard can escort them into a restricted room for a few minutes (elevation), and cameras record the whole visit (audit).
  • Session versus token:: A session is the server-side record of an active, authenticated principal.
  • Tokens expire and can be revoked.
iotclass.org

Major section

Practitioner: Run Sessions, Tokens, and Elevation

Operating access control means setting a handful of lifetimes and limits well, and coordinating them across the tiers of a system.

  • The central trade-off is constant: shorter lifetimes shrink the window an attacker has with a stolen credential, but they cost more frequent refreshes, which on a battery device means more radio time and energy.

Key terms

Refresh tokens
Refresh tokens are powerful because they mint new access tokens, so they need their own discipline.
The token lifecycle in motion: authenticate once, present the signed token on each request, and refresh or revoke it as it ages.
The token lifecycle in motion: authenticate once, present the signed token on each request, and refresh or revoke it as it ages.
iotclass.org

Major section

Practitioner: Run Sessions, Tokens, and Elevation (continued)

Verification can reject an expired or revoked token without repeating the original login.

  • Tune each lifetime to the risk it carries.
  • An absolute timeout caps the total session length so a session cannot live indefinitely, even for an active user.
  • Who: whoever presents a refresh token; each one is single-use and invalidated when exchanged.
iotclass.org

Major section

Practitioner: Run Sessions, Tokens, and Elevation (continued)

A design needs both: absolute alone lets an abandoned terminal stay open until its hard limit, and idle alone lets an attacker keep a hijacked session alive forever with periodic activity.

  • The client first proves its credentials to the authentication server, receives a signed token, and then presents that token to the API on each request.
  • Idle and absolute timeouts therefore govern the lifetime of this continuing authority, which is why the refresh path needs separate protection rather than being treated as an unlimited extension.
  • Who: the operator who walked away — the gateway’s idle limit already says the human is gone.
iotclass.org

Major section

Practitioner: Run Sessions, Tokens, and Elevation (continued)

The fix is to make the downstream tiers honor the upstream session state, so that a refresh is denied once the gateway session has hit its idle limit.

  • Rotate them on every use and make each one single-use: when a refresh token is exchanged, invalidate it and issue a fresh one.
  • Elevation is not the same as changing someone's role: it is temporary, bounded, and recorded, which keeps a precise audit trail of exactly when extra authority was used and why.
  • If you can set lifetimes by risk, rotate refresh tokens, bound elevation, and coordinate tiers, you can stop here.
iotclass.org

Major section

Under the Hood: Lifecycle, Revocation, and the Stateless Trade-Off

The deeper layer shows how each request is actually validated, how escalation is detected, and why statelessness and instant revocation pull against each other.

  • The details are where defense in depth either holds or quietly fails.
  • A token arrives as untrusted bytes, and the validation order matters.
  • Refresh has its own guards.

Key terms

Encoding
Encoding is not signing.
iotclass.org

Major section

Under the Hood: Lifecycle, Revocation, and the Stateless Trade-Off (continued)

In parallel, compare now with session start for the absolute limit and with last activity for the idle limit.

  • Who: rights are clamped to the principal’s ceiling the moment a token is minted.
  • Escalation detection compares what was attempted against the ceiling.
  • Encoding is not signing.
iotclass.org

Major section

Under the Hood: Lifecycle, Revocation, and the Stateless Trade-Off (continued)

Proof: the request acts only after every layer passes, then success updates last activity while absolute and idle limits remain enforced.

  • Any requested right that lies outside the principal's maximum authority is a forbidden bit, and a single forbidden bit marks an escalation attempt: it is audited and denied.
  • Repeated attempts within a short window are treated as probing and can trigger a lockdown that terminates the session.
  • The counter resets after the window passes, so a stray mistake does not permanently lock out a legitimate user.
  • A compact encrypted JWT carried as JWE has five parts.
iotclass.org

Major section

Under the Hood: Lifecycle, Revocation, and the Stateless Trade-Off (continued)

A compact signed JWT carried as JWS normally has three base64url parts: a protected header, a payload, and a signature.

  • In this chapter, "signed token" means a compact JWS whose allowed algorithm, trusted key, and signature are all verified.
  • Likewise, authoritative permission flags in a client-held token need that verification and a revocation plan; for prompt revocation, keep authoritative rights server-side or consult server-side state.
  • A signed token can be verified using only the signing key, with no session store -- the appeal of stateless authentication is exactly this scalability.
iotclass.org

Deck summary

Key takeaways

The system must end those rights even if the person forgets.

  • “Security is not a wall, it’s a list of who can do what — and the proof that the list is enforced.”.
  • A real system must keep deciding, continuously, as users log in and walk away, as tokens age out, as a device temporarily needs more rights and then gives them back, and as credentials are revoked.
  • They sign in (a session record), receive a badge that expires that evening (a token with an absolute timeout), and have it reclaimed if they wander off unaccompanied (an idle timeout).
iotclass.org

Retrieval practice

Recall check 1 of 3

Shield Shelly says: answer from memory, then check your reasoning.

Q1In a well-designed system, what does an access token fundamentally represent?

AA permanent identity that never needs to be refreshed or revoked
BTemporary, expiring proof that a successful authentication already happened.
CAn encryption key used to protect the message body
DThe user's raw password, sent on every request for convenience
Show answer

Answer: B A token carries the result of a prior authentication for a limited time; it is not a permanent identity or an encryption key.

iotclass.org

Retrieval practice

Recall check 2 of 3

Shield Shelly says: answer from memory, then check your reasoning.

Q2An operator console session is configured with an 8-hour absolute timeout and a 10-minute idle timeout. The operator authenticates, works briefly, then leaves the terminal unattended for 15 minutes. What happens on their return, and why?

AThe session has expired due to the idle timeout
BThe session is still active, because only the 8-hour absolute timeout matters
CThe session is still active, because idle timeouts apply only to administrators
DThe session resumes with a fresh idle timer when the operator returns.
Show answer

Answer: A The idle timeout exists exactly to reclaim unattended terminals.

iotclass.org

Retrieval practice

Recall check 3 of 3

Shield Shelly says: answer from memory, then check your reasoning.

Q3A service uses purely stateless, signed JWTs with a one-hour lifetime and keeps no server-side session state. Security requires that a user's access end immediately when they log out. What must change?

ARe-sign the existing token with a new key to invalidate it instantly
BSwitch the signing algorithm from HS256 to RS256 to enable revocation
CAdd server-side revocation state (such as a denylist or token introspection).
DNothing; stateless JWTs already support instant logout by design
Show answer

Answer: C Statelessness trades away instant revocation.

iotclass.org

Print reference

Answers

Answer key.

  1. B · A token carries the result of a prior authentication for a limited time; it is not a permanent identity or an encryption key.
  2. A · The idle timeout exists exactly to reclaim unattended terminals.
  3. C · Statelessness trades away instant revocation.
iotclass.org