Scrivio Interview library

JWT structure

ConceptFoundations6 min read
Describe the structure of a JWT and the meaning of the registered claims iss, sub, aud, exp, nbf, iat and jti. Is the payload of a signed JWT secret?
DesignIntermediate5 min read
What claims would you put in access tokens for your APIs, and what would you keep out? A team wants to add the user's full permission list, email, address and account balance.
DesignAdvanced6 min read
Different teams interpret access token claims differently: some read roles from "roles", others from "groups", and tenant ids appear in three formats. Define a claims contract for your organisation's tokens.
LeadershipPrincipal5 min read
Your platform passes user identity between dozens of internal services and several partner companies using JWTs. Looking ahead several years, how would you design identity propagation so trust stays explicit as the number of parties grows?

Signature validation

InternalsFoundations5 min read
Explain how a resource server validates a JWT signed with RS256 using a JWKS endpoint, and the difference from HS256.
CodingIntermediate6 min read
Write the configuration of a JwtDecoder bean that validates tokens from a JWKS URL, accepts only ES256, requires the issuer https://login.example.com and the audience billing-api, and allows 30 seconds of clock skew.
DebuggingIntermediate7 min read
A code review finds a hand-written JWT filter that decodes the token, reads the alg header and chooses the verification method from it. What attacks does this allow, and what should the code do?
DesignAdvanced7 min read
Define a token signing and validation standard for 100 services: who may sign tokens, which algorithms, how keys are published and cached, and how fast key rotation must take effect.
LeadershipPrincipal7 min read
Imagine the private key your identity provider uses to sign access tokens is suspected to be compromised. Treat this as a business continuity problem: what must already be in place, and what happens in the first hours?

Expiry and refresh tokens

ConceptFoundations6 min read
Why are access tokens usually short-lived while refresh tokens live longer? What is refresh token rotation and what does reuse detection add?
DebuggingIntermediate7 min read
Users of a mobile app are logged out randomly. Logs show refresh requests failing with invalid_grant shortly after another refresh succeeded. The app sends several API calls in parallel when it starts. What is happening?
LeadershipAdvanced6 min read
Set the token lifetime policy for web sessions, mobile apps and service-to-service tokens in your company. What lifetimes and rules would you choose, and how would you justify them?
LeadershipPrincipal6 min read
Product leaders want customers to stay signed in on mobile for months, while security and regulators push for stronger session controls. How would you set a long-term approach that balances user experience, fraud and compliance?

Revocation

DesignIntermediate6 min read
A fraud team needs to block a compromised account's JWT access tokens within one minute across 30 services. Tokens live for 15 minutes. Design a solution.
LeadershipAdvanced6 min read
Your security policy says tokens must be revocable, but your architecture relies on stateless JWT validation everywhere. How would you reconcile the policy and the architecture?

JWT pitfalls

DebuggingFoundations6 min read
List common mistakes when using JWTs in a Spring service, such as those found in code reviews, and the correct approach for each.
ScenarioIntermediate6 min read
A team proposes replacing server sessions with JWTs stored in cookies for a server-rendered web application, saying it will make the app stateless and faster. How would you review this proposal?
LeadershipPrincipal6 min read
JWTs became the default token format across your industry. Looking at incidents over the past decade, what would you tell your architecture board about when JWTs are the right choice and when they are not?