JWS dan Kumpulan JWK
Pelajari JSON Web Signatures (JWS) dan JSON Web Key Sets (JWKS) untuk memverifikasi keaslian Token ID.
JWS dan Kumpulan JWK adalah pelajaran OAuth2 & OpenID Connect Deep Dive gratis di CoddyKit. Ini adalah pelajaran 2 dari 4. Kamu bisa membaca pelajaran lengkapnya di bawah secara gratis — lalu praktikkan langsung di browser dengan editor kode bawaan dan tutor AI 24/7. Ini adalah bagian dari jalur belajar OAuth2 & OpenID Connect Deep Dive, dan progresmu tersinkronisasi di web dan aplikasi CoddyKit. Kursus OAuth2 & OpenID Connect Deep Dive mencakup 4 pelajaran total.
Bagian dari pelajaran ini belum diterjemahkan dan ditampilkan dalam bahasa Inggris.
JWS & JWK Sets Intro
Welcome! In this lesson, we'll dive into two crucial components for securing OpenID Connect: JSON Web Signatures (JWS) and JSON Web Key Sets (JWKS).
These mechanisms ensure that the ID Tokens you receive are authentic and haven't been tampered with.
Why Signatures are Essential
Imagine receiving an ID Token that tells you who a user is. How do you know it's truly from the trusted Identity Provider and not a malicious actor?
This is where signatures come in. They provide:
- Authenticity: Verifying the sender's identity.
- Integrity: Ensuring the token hasn't been changed since it was signed.
JSON Web Signature (JWS)
A JSON Web Signature (JWS) is a compact, URL-safe representation of signed content. Think of it as a digital seal on your JSON data.
An ID Token is typically a type of JWS, meaning it has been digitally signed to prove its origin and integrity.
JWS Structure: 3 Parts
A JWS consists of three parts, separated by dots (.):
- Header: Describes the signing algorithm (e.g., RS256) and the key used.
- Payload: The actual data (e.g., the user claims in an ID Token).
- Signature: The cryptographic signature generated from the header, payload, and a secret key.
Example: HEADER.PAYLOAD.SIGNATURE
JSON Web Key (JWK)
To verify a JWS signature, you need the correct public key. A JSON Web Key (JWK) is a standard way to represent cryptographic keys (like RSA or EC public keys) in a JSON format.
It makes it easy for systems to share and understand cryptographic keys.
Key Details in a JWK
A JWK contains several parameters to describe a key. Common ones include:
kty(Key Type): e.g.,RSA,ECuse(Public Key Use): e.g.,sig(for signing)alg(Algorithm): e.g.,RS256kid(Key ID): A unique identifier for the key.- Specific key components (e.g.,
nandefor an RSA public key).
JSON Web Key Set (JWKS)
An Identity Provider (IdP) might use several keys for signing ID Tokens, or rotate them over time. A JSON Web Key Set (JWKS) is a JSON object containing an array of JWKs.
It's the standard way for an IdP to publish all its public keys that clients can use for verification.
Discovering the JWKS Endpoint
How does your application find the IdP's JWKS?
The OpenID Connect Discovery Endpoint (e.g., https://idp.com/.well-known/openid-configuration) provides a URL called jwks_uri.
Your application fetches the JWKS from this jwks_uri to get the public keys needed for verification.
ID Token Verification Flow
Here's the typical process for a client to verify an ID Token:
- Receive the ID Token (JWS).
- Parse its header to find the
kid(Key ID) andalg(algorithm). - Fetch the JWKS from the IdP's
jwks_uri. - Locate the JWK in the JWKS that matches the
kidandalgfrom the ID Token header. - Use the public key from the matched JWK to cryptographically verify the ID Token's signature.
Quick Check: JWS & JWKS
An ID Token is received by a client application. The client needs to verify its signature. Which of the following is the correct sequence of actions?
Recap: JWS & JWK Sets
Great job! You've learned about the core components for ID Token security:
- JWS: A signed JSON structure, ensuring token authenticity and integrity.
- JWK: A standard JSON format for cryptographic keys.
- JWKS: A set of JWKs published by an IdP, allowing clients to discover and retrieve public keys for signature verification.
These pieces work together to build trust in the identity information provided by OpenID Connect.
Pertanyaan yang Sering Diajukan
Apakah pelajaran “JWS dan Kumpulan JWK” gratis?
Ya — teks lengkap “JWS dan Kumpulan JWK” gratis dibaca di sini di web. Untuk praktiknya secara interaktif (editor kode bawaan dan tutor AI 24/7) dan buka sisa kursus OAuth2 & OpenID Connect Deep Dive, upgrade ke CoddyKit PRO. Kursus OAuth2 & OpenID Connect Deep Dive mencakup 4 pelajaran total.
Apa yang akan aku pelajari di “JWS dan Kumpulan JWK”?
Pelajari JSON Web Signatures (JWS) dan JSON Web Key Sets (JWKS) untuk memverifikasi keaslian Token ID. Kamu berlatih OAuth2 & OpenID Connect Deep Dive dengan kode praktik yang langsung kamu jalankan di browser, dan tutor AI 24/7 menjawab pertanyaanmu saat kamu mengerjakan pelajaran ini.
Apakah aku perlu pengalaman untuk memulai OAuth2 & OpenID Connect Deep Dive?
Tidak diperlukan pengalaman sebelumnya. OAuth2 & OpenID Connect Deep Dive di CoddyKit dirancang untuk pemula hingga pelajar tingkat lanjut, jadi kamu bisa memulai di sini atau dari awal dan belajar sesuai kecepatan kamu sendiri. Ini adalah pelajaran 2 dari 4.
Berapa lama pelajaran “JWS dan Kumpulan JWK” memakan waktu?
Sebagian besar pelajaran CoddyKit memakan waktu sekitar 5–10 menit. Setiap pelajaran ringkas dan interaktif, jadi kamu membuat kemajuan stabil dan melanjutkan dari tempat kamu tinggalkan di web dan aplikasi.
Bisakah aku menulis dan menjalankan kode dalam pelajaran OAuth2 & OpenID Connect Deep Dive ini?
Ya. Setiap pelajaran OAuth2 & OpenID Connect Deep Dive menyertakan editor kode bawaan, jadi kamu menulis dan menjalankan kode nyata langsung di browser dan mendapatkan umpan balik AI instan — tidak diperlukan penyiapan lokal.
Semua pelajaran dalam kursus ini
- Struktur dan Tanda Tangan Token ID
- JWS dan Kumpulan JWK
- Pencabutan dan Introspeksi Token
- Memvalidasi Klaim Token ID Standar