Application authentication and threat modeling
Authenticate first, authorize each resource
Authentication establishes identity; authorization decides what that identity may do. Cognito user pools issue tokens for application users; identity pools can exchange supported identities for temporary AWS credentials under configured roles. For the fictional reports API, verify access-token signature against trusted issuer keys, issuer, expiration, intended app/client and token type according to the provider contract. Check the required scope (reports/read) and enforce report ownership or tenant membership in the application using trusted server-side records. A valid token with a read scope is not permission to read every report.
Protect APIs and service identities
Configure a supported API Gateway authorizer to validate tokens and required scopes, and verify that the backend cannot be reached without the intended controls. REST and HTTP API authorizer features differ; check the chosen API type. For service-to-service traffic, use workload roles for AWS APIs or appropriately scoped machine credentials for application APIs. Keep tokens out of URLs and logs, enforce TLS and validate expected input fields and sizes. Treat client-supplied tenant identifiers as untrusted; resolve access from authenticated identity and stored membership. Use parameterized database operations and deny by default when required evidence is absent.
Threat model a benign reports API
A threat model describes assets, trust boundaries, unwanted outcomes, controls and evidence. Assets include report contents, user identity and service credentials. At the edge, service availability needs rate controls; at the origin, unintended exposure needs private ingress; at the application, disclosure to the wrong tenant needs resource authorization; at the build boundary, stale dependencies need maintenance and scan review. For each control identify an owner, evidence and residual risk. Review safe synthetic requests for a valid reader, an expired identity and a reader from another fictional tenant; never test against an unapproved target.
Offline control matrix
The fixture models independent pre-evaluated checks: edge allowed, private origin path, token verified, required scope and matching server-side tenant. Predict the original result (allow), then change only one condition at a time; each missing requirement denies. The Boolean token field represents a decision already made by a trusted validator, not a real JWT. This model does not inspect HTTP, verify signatures, implement IAM, evaluate WAF rules or prove infrastructure security. Run the tests and explain why a successful network connection or a verified token is insufficient by itself.
{ "edgeAllowed": true, "privateOriginPath": true, "tokenVerified": true, "scopes": [ "reports/read" ], "principalTenant": "demo-a", "reportTenant": "demo-a"}Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
Application authentication and threat modeling — knowledge check
Reason about defensive controls and synthetic access decisions.
A verified reader token has the required scope but belongs to another tenant. What should happen?
What does a Cognito user pool supply?
Which token check is necessary before trusting claims?
Which data should determine report ownership?
What does the offline Boolean token field represent?