Wrap Up

ជំពូកនេះមិនទាន់ត្រូវបានបកប្រែជាភាសាខ្មែរនៅឡើយទេ — សូមអានជាភាសាអង់គ្លេសខាងក្រោម។

Table of Contents

  1. The Final Architecture
  2. Recap
  3. What We Deliberately Skipped

1. The Final Architecture

Keycloak holds the user, client, roles, and tokens; the NestJS API validates the access token through a JWT Guard and a Roles Guard

Every request into the NestJS API now travels the same path: User → Keycloak (authenticate) → Access Token → NestJS API → JWT Guard → Roles Guard → Response. That's the one idea worth keeping from this whole hour: Keycloak isn't a pile of screens to memorize — it's a single consistent flow, with your API trusting a token instead of ever handling a password.

2. Recap

TermWhat it meansCovered in
RealmAn isolated tenant of users, clients, and rolesPart 2, Part 3
UserAn account inside a realmPart 2, Part 4
ClientAn application registered against a realmPart 2, Part 4
RolesWhat a user is allowed to doPart 2, Part 7
OAuth 2.0Protocol for authorization — how a token is obtainedPart 2
OpenID ConnectIdentity layer on top of OAuth 2.0 — adds authenticationPart 2
Authorization CodeThe short-lived code exchanged for tokensPart 5
Access TokenProves authentication; sent with every API requestPart 2, Part 6
Refresh TokenUsed to get a new access token without logging in againPart 2
ID TokenDescribes who the user isPart 2
JWTThe encoded format tokens are issued inPart 6
Authentication"Who are you?"Part 1
Authorization"What are you allowed to do?"Part 1
API protectionValidating a token, then checking its rolesPart 7

3. What We Deliberately Skipped

This was a 1-hour crash course, not the whole product. Left out on purpose, each worth its own dedicated deep dive:

  • LDAP integration — syncing against an existing corporate directory
  • Google / GitHub identity providers — social login
  • Custom themes — branding the login pages
  • User federation — beyond LDAP, other external user stores
  • Fine-grained authorization — resource- and permission-based authorization services, beyond simple realm roles
  • Keycloak clustering / high availability
  • Custom SPI / providers — extending Keycloak's own behavior
  • Kubernetes deployment
  • Production security hardening — real databases, HTTPS, hostname configuration (everything start-dev skips)
  • Advanced token customization — custom claims, token exchange

If you want to go deeper on the NestJS side of this stack, the companion NestJS Crash Course series covers building the rest of a production-style API — this crash course's reference implementation is deliberately built to drop straight into that project's structure.

ទិញកាហ្វេជូនខ្ញុំ

ចូលចិត្តមេរៀននេះមែនទេ? សូមពិចារណាទិញកាហ្វេជូនខ្ញុំមួយកែវ ដើម្បីគាំទ្រការបង្កើតមាតិកាឥតគិតថ្លៃបន្ថែមទៀត!