Authentication & Access · Study deck

Advanced Access Control: Token Lifecycles and Sessions

In an IoT platform, the bearer value may move through a browser, mobile app, gateway, cloud API, device-management service, and constrained device.

Shield Shelly is your guide for this deck.

authconceptssecurity
Shield Shelly, the module guide, in a scene from this chapter.
iotclass.org

After studying this chapter

Learning objectives

You will be able to:

  • Test deep dive: token lifecycle and stateless access with a concrete scenario and pass criteria.
  • Validate 4. deleting audit logs without retention policy with a concrete scenario and pass criteria.
  • 'test deep dive: token lifecycle and stateless access with a concrete scenario and pass criteria'
  • validate 4. deleting audit logs without retention policy with a concrete scenario and pass criteria
iotclass.org

Major section

Deep Dive: Token Lifecycle and Stateless Access

A leaked token is therefore not just leaked metadata.

  • After a user or device authenticates, the system has to remember that fact without rechecking the password, hardware key, or certificate on every request.
  • That memory is usually carried as a session identifier or access token.
  • That property drives the engineering controls.

Why it matters

The token needs integrity so that a holder cannot edit its subject, role, audience, or expiry.

iotclass.org

Major section

Deep Dive: Token Lifecycle and Stateless Access (continued)

Each hop changes the threat.

  • The critical property is bearer semantics: whoever holds the bearer value is treated as the subject.
  • It needs a bounded lifetime so that a stolen copy does not work forever.
  • A browser can leak a token through local storage or a referrer header.
  • The algorithm choice changes key exposure.
iotclass.org

Major section

Deep Dive: Token Lifecycle and Stateless Access (continued)

It also needs an inventory record: who issued it, which service should accept it, what authority it grants, where it is stored, and which operational lever disables it when risk changes.

  • In an IoT platform, the bearer value may move through a browser, mobile app, gateway, cloud API, device-management service, and constrained device.
  • A gateway can log request headers during field debugging.
  • A robust verifier is deliberately repetitive.
iotclass.org

Major section

Deep Dive: Token Lifecycle and Stateless Access (continued)

A device can keep a refresh token in flash storage that is extracted during repair or resale.

  • Token design has to define storage location, verifier scope, expiry, refresh policy, and log-safe identifiers before the platform is deployed.
  • HMAC uses one shared secret for signing and verifying, so every verifier that holds the secret can also forge tokens.
  • It should never trust a token-supplied algorithm, key URL, or issuer hint.
iotclass.org

Major section

Deep Dive: Token Lifecycle and Stateless Access (continued)

ECDSA or RSA lets services verify with a public key while the issuer keeps the signing key private.

  • Production JWT deployments commonly publish verification keys through a controlled JWKS endpoint and identify the current key with kid, but the verifier must resolve keys only from trusted issuer configuration.
  • For device operations that can change safety, billing, or fleet state, the verifier may also require recent device posture, mTLS binding, or proof-of-possession rather than accepting any copied bearer string.
  • The token needs integrity so that a holder cannot edit its subject, role, audience, or expiry.
iotclass.org

Major section

Debate: Security vs. Usability Trade-offs

Removing the control may be unsafe, but a control that people bypass is not a sound result either.

  • Firmware means the program stored on a device to control its hardware.
  • A real-time operating system means software that schedules device tasks within known timing rules; it is shortened to RTOS.
  • This exercise tests named tasks and users, not all security or accessibility needs.
iotclass.org

Major section

Putting Numbers to It: Session Timeout Optimization

This analytical result (about 8.5 minutes) suggests that for high-impact enterprise IoT systems, short session timeouts are mathematically optimal.

  • The interactive calculator above lets you verify this and explore how the optimal value shifts as you change the inputs.
  • In practice: Session timeout selection requires quantifying both security costs (breach exposure window) and usability costs (re-authentication frequency).
  • For high-security IoT (medical devices, industrial control), short timeouts ($T = 5$-$15$ minutes) are warranted despite usability costs.
  • The optimal session timeout $T_{\text{optimal}}$ balances security (shorter timeouts limit breach window) against usability (longer timeouts reduce re-authentication frequency).
iotclass.org

Deck summary

Key takeaways

A leaked token is therefore not just leaked metadata.

  • Each hop changes the threat.
  • It also needs an inventory record: who issued it, which service should accept it, what authority it grants, where it is stored, and which operational lever disables it when risk changes.
  • A device can keep a refresh token in flash storage that is extracted during repair or resale.
  • ECDSA or RSA lets services verify with a public key while the issuer keeps the signing key private.
iotclass.org

Retrieval practice

Recall check 1 of 4

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

Q1This chapter's 'Security vs Usability' discussion prompt asks a smart home company to weigh 2FA rigor against user adoption. Which of these is one of the four options the chapter actually lists to debate?

ARisk-based authentication that requires 2FA only for sensitive actions
BBiometric-only login with no password or PIN fallback
CMandatory 2FA with no setup guidance provided
DHardware tokens sold as a separate paid upgrade
Show answer

Answer: A The chapter lists exactly four options to debate for the 2FA scenario: mandatory 2FA with guided setup, optional 2FA with strong defaults, risk-based authentication (2FA only for sensitive actions), and hardware tokens included with purchase.

iotclass.org

Retrieval practice

Recall check 2 of 4

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

Q2A study group is discussing IoT security. One member states: 'We should just encrypt everything with AES-256 — problem solved.' Which discussion prompt would best help the group explore why this oversimplification is problematic?

AWhich AES-256 disadvantages should we list before choosing another cipher?
BHow would AES-256 fit a 2KB-RAM sensor on a five-year coin-cell budget?
CIs AES-256 the strongest algorithm available for connected devices?
DShould IoT teams avoid encryption when devices are highly constrained?
Show answer

Answer: B A blanket claim like 'encrypt everything with AES-256' skips past whether the control actually fits the device.

iotclass.org

Retrieval practice

Recall check 3 of 4

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

Q3A session token has a 30-minute maximum duration and a 10-minute idle timeout. A device authenticates at 14:00 and sends data at 14:05, 14:14, and 14:23. When does the session expire?

A14:24 because the idle timer starts at 14:14
B14:33 because the idle timeout resets at 14:23
C14:30 because the absolute maximum overrides the idle extension
D14:53 because each activity extends the maximum duration
Show answer

Answer: C Two timeout mechanisms work together: idle timeout (10 minutes since last activity) and absolute maximum (30 minutes from session start).

iotclass.org

Retrieval practice

Recall check 4 of 4

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

Q4Device attestation verifies that an IoT device is running authentic firmware. An attacker replaces the firmware with malware but the secure element's attestation key still works. Why does attestation still detect the compromise?

AThe cloud compares the signed hash with known-good firmware hashes
BThe secure element refuses to sign if firmware is modified
CThe attestation key changes when firmware is updated
DThe malware cannot access the secure element
Show answer

Answer: A Device attestation works through hash comparison, not signature validity.

iotclass.org

Print reference

Answers 1 of 2

Answer key.

  1. A · The chapter lists exactly four options to debate for the 2FA scenario: mandatory 2FA with guided setup, optional 2FA with strong defaults, risk-based authentication (2FA only for sensitive actions), and hardware tokens included with purchase.
  2. B · A blanket claim like 'encrypt everything with AES-256' skips past whether the control actually fits the device.
  3. C · Two timeout mechanisms work together: idle timeout (10 minutes since last activity) and absolute maximum (30 minutes from session start).
iotclass.org

Print reference

Answers 2 of 2

Answer key.

  1. A · Device attestation works through hash comparison, not signature validity.
iotclass.org