Share E-Book
Scan to open this page

Scan with your phone to open this page

Author: Gary Archer, Judith Kahrer, Michał Trojanowski

Rating No ratings yet

With the growth of cloud native applications, developers increasingly rely on APIs to make everything work. But security often lags behind, making APIs an attractive target for bad actors looking to access valuable business data. OAuth is a popular way to address this issue, but this open standard doesn't provide sufficient guidelines for using API tokens to protect business data. That alone can lead to vulnerabilities and invite data breaches. By using cloud native components in Kubernetes or similar platforms, organizations can implement a scalable, future-proof security architecture for their systems that follows a zero-trust approach to protect business data. You'll access tokens, claims, and token design with an emphasis on an API-first approach. This book takes readers through an end-to-end security architecture that scales to many components in a cloud native environment, while only requiring simple security code in applications and APIs. You'll learn: Why user identity must be part of your cloud native security stack How to integrate user identity into APIs How to externalize security, secure data access, and authenticate clients using OAuth Methods for running security components in a Kubernetes cluster How to use claims to protect business data in APIs How to follow security best practices for client applications and APIs

AI Reading Assistant

Whole-book reading guide from stratified index samples; jump to passages in the text

AI guide
【One-Line Pitch】 A practical architecture guide for teams building cloud native APIs that need real data protection, not just login: it shows how to combine OAuth 2.0, token claims, and Kubernetes-hosted security components into a scalable zero-trust design. Best for backend, API, and platform engineers who already know Kubernetes basics and want security patterns they can actually implement. 【Book Arc】 - **Opening (~0%–10%)**: Sets up the core problem—APIs are the new attack surface, and weak internal patterns (shared API keys, plain user-ID headers) fail under zero trust—then previews the reference architecture and the browser/client threat landscape. - **Early (~10%–35%)**: Distills OAuth 2.0 essentials: the three token types, client capabilities, public vs. confidential clients, the code flow with PKCE, and why legacy flows like implicit should be retired. This is the vocabulary layer for everything later. - **Middle (~35%–55%)**: Introduces the component architecture—authorization server, API gateway, policy engine, APIs—and assigns responsibilities to each party, including client obligations for token handling and the authorization server's configuration, key, and identity data. - **Late (~55%–85%)**: Moves into token design and claims as the mechanism for protecting business data in APIs, plus operational concerns like running security components reliably in a Kubernetes cluster (excerpts do not detail these chapters). - **Ending (~85%–100%)**: Applies the model to concrete client types—console, desktop, mobile, and browser-based applications—covering BFF vs. JavaScript OAuth clients and web security mechanisms like CSP, CORS, and secure cookies. 【Book Arc】(continued) - **Practice thread throughout**: Code examples in a GitHub repository accompany the theory, deliberately complex because they mirror a distributed architecture; the authors frame them as optional but useful for comparison. 【Key Takeaways】 - **OAuth alone is not a data-security strategy** (Opening): the standard governs token issuance, not how APIs should use tokens to protect business data—that design work is on you, and skipping it invites breaches. - **Treat access tokens as opaque on the client** (Early): clients should never parse token contents or build logic on claims; doing so leaks sensitive data and breaks when the authorization server changes token format. APIs, not clients, interpret scopes and claims. - **Use the code flow with PKCE; drop the implicit flow** (Early): PKCE binds the authorization code to the session and mitigates code interception and injection attacks, and modern browsers no longer justify implicit. - **Externalize security into dedicated components** (Middle): a cloud native authorization server is the minimum addition; an API gateway can enforce coarse-grained checks early, and a policy engine can be added later. Applications and APIs then need only simple security code. - **Every component must trust the authorization server** (Middle): clients, gateway, APIs, and policy engine all need to fetch keys or validate tokens—and API SLAs should account for the authorization server's SLA, since token issuance failures become business interruptions. - **Least privilege is enforced through scopes and claims** (Early/Middle): grant the bare minimum, verify scope and claim values in APIs, and let claims drive both authorization decisions and which data is returned. - **Client-side token hygiene is non-negotiable** (Middle): HTTPS everywhere with certificate validation, tokens never in URLs, secure storage at rest, and revocation on logout. - **Browser clients need layered defenses** (Ending): same-origin policy, CSP, secure cookie settings, and CORS complement OAuth; the BFF pattern is presented as the safer alternative to pure JavaScript clients for token handling. 【Reading Tips】 - If you already know OAuth, skim the early distillation chapters for the authors' opinions (opaque tokens, PKCE, retiring implicit) and slow down at the architecture and claims chapters—that's where the book's distinctive value sits. - Read the "What This Book Is Not" preface carefully: it explicitly excludes Kubernetes fundamentals, deep cryptography, and OS/container/database hardening, so calibrate expectations and fill gaps elsewhere. - Treat the code examples as a reference implementation, not a tutorial; study the READMEs alongside the relevant chapter rather than reading code linearly. - Deep-read the client-type chapters (browser, mobile, desktop) matching your actual deployment targets; skim the others for pattern comparison. - Take away one artifact: a diagram of your own system mapped onto the book's component responsibilities (client, gateway, authorization server, policy engine, APIs). 【Coverage Limits】 The excerpts cover the preface, table of contents, and early-to-middle chapters on OAuth fundamentals and architecture; the token-design, Kubernetes operations, and client-specific chapters are only partially represented, so this guide's late-stage claims are inferred from chapter titles and summaries rather than full text.
Page 8
. . . . . . . . . . . . . . . . . . . . . . . . . . . . xv Part I. Introducing Cloud Native OAuth 1. Why Do You Need OAuth?. . . . . . . . . . . . . . . . ....
View in text
Excerpt 2
book’s theory with code examples that you can download from the book’s GitHub repository. Using code examples is entirely optional but may be useful if you w...
View in text
Excerpt 3
ethod in the authorization request. Example 2-6 illustrates an authorization request with PKCE that includes both a hash in the code_challenge and the hash m...
View in text
Excerpt 4
ion server Your configuration data includes client settings. You typically must register clients at the authorization server before they can receive tokens....
View in text
Excerpt 5
in the next section. 86 | Chapter 5: Secure API Development • The user’s region in your API logic • The level of assurance that represents the strength with...
View in text
Excerpt 6
d to call an upstream service, you can use “OAuth 2.0 Token Exchange” (RFC 8693) to obtain a new access token with a reduced scope. Doing so maintains the us...
View in text
Excerpt 7
y should enable the best options for both APIs and clients. Once you have these token foundations, you are well placed to further harden your access tokens....
View in text
Excerpt 8
vide the files in the following list: • 1-create-cluster.sh • 2-deploy-api-gateway.sh • 3-deploy-authorization-server.sh 172 | Chapter 8: Proxies, Gateways,...
View in text
Tags
AI categories
CybersecurityCloud NativeBackend
ISBN: 1098164881
Publisher: O'Reilly Media
Publish Year: 2025
Language: English
Pages: 390
File Format: PDF
File Size: 7.6 MB
Text Preview (First 20 pages)
Registered users can read the full content for free

Register as a Gaohf Library member to read the complete e-book online for free and enjoy a better reading experience.

Generating text preview…