ID 토큰 구조 및 서명
ID 토큰(JWT)의 헤더, 페이로드, 서명을 분석하고 서명 방식과 포함된 정보를 이해해 보세요.
ID 토큰 구조 및 서명은(는) CoddyKit의 무료 OAuth2 & OpenID Connect Deep Dive 강의입니다. 이것은 4개 중 1번째 강의입니다. 아래에서 전체 강의를 무료로 읽을 수 있으며, 내장 코드 에디터와 24/7 AI 튜터와 함께 브라우저에서 직접 실습할 수 있습니다. 이 강의는 OAuth2 & OpenID Connect Deep Dive 학습 경로의 일부이며, 진행 상황이 웹과 CoddyKit 앱에 동기화됩니다. OAuth2 & OpenID Connect Deep Dive 강의에는 총 4개의 강의가 포함되어 있습니다.
이 강의의 일부는 아직 번역되지 않았으며 영어로 표시됩니다.
Meet the ID Token
In OpenID Connect (OIDC), the ID Token is a crucial piece of information. It's a security token that contains claims about the authentication of an end-user by an Authorization Server.
Think of it as a digital ID card for the user, issued after they successfully log in.
ID Tokens Are JWTs
ID Tokens are always formatted as JSON Web Tokens (JWTs). A JWT is a compact, URL-safe means of representing claims to be transferred between two parties.
Every JWT has three main parts, separated by dots:
- Header
- Payload
- Signature
The Header: What Algorithm?
The first part of an ID Token is the Header. It's a JSON object that describes the token itself, like what type of token it is and the algorithm used to sign it.
alg: The cryptographic algorithm used for signing (e.g., RS256, HS256).typ: The type of token, which is usually"JWT".
Header in Action
When you decode the base64url-encoded header, you'll see a JSON object like this. This tells you how the token was secured.
{
"alg": "RS256",
"typ": "JWT",
"kid": "someKeyId"
}The kid (Key ID) helps find the correct public key for verification.
Decoding Header Example
The header is base64url encoded. Here's how you might decode a JWT header string in Java. This helps reveal its content.
import java.util.Base64;
import java.nio.charset.StandardCharsets;
public class JwtDecoder {
public static void main(String[] args) {
String encodedHeader = "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6InNvbWVLZXlJZCJ9";
byte[] decodedBytes = Base64.getUrlDecoder().decode(encodedHeader);
String decodedString = new String(decodedBytes, StandardCharsets.UTF_8);
System.out.println("Decoded Header:");
System.out.println(decodedString);
}
}The Payload: Claims About You
The second part is the Payload. This is where the actual "claims" about the user and the authentication event are stored. Claims are statements about an entity (typically the user).
Standard claims you'll often see include:
iss: Issuer (who issued the token).sub: Subject (unique identifier for the user).aud: Audience (who the token is for).exp: Expiration Time (when the token expires).iat: Issued At Time (when the token was issued).
Payload in Action
Similar to the header, the payload is also a base64url-encoded JSON object. It contains the identity information you need.
{
"iss": "https://example.com/auth",
"sub": "user123",
"aud": "myAppClientId",
"exp": 1678886400,
"iat": 1678882800,
"name": "Alice Wonderland"
}exp and iat are Unix timestamps.
The Signature: Ensuring Trust
The third and final part is the Signature. This is critical for security! It's used to verify that the token hasn't been tampered with and that it comes from a legitimate issuer.
The signature is created by taking the encoded header, the encoded payload, and a secret key or private key, and running them through the cryptographic algorithm specified in the header.
Verifying the Signature
When your application receives an ID Token, it uses the public key (provided by the Issuer) to verify the signature. It re-computes the signature using the header, payload, and the public key.
If the re-computed signature matches the token's signature, you can trust that:
- The token hasn't been altered.
- It was issued by the expected Authorization Server.
Quick Check on JWT
You've learned that ID Tokens are structured as JWTs, with three distinct parts. Each part plays a vital role in conveying and securing user identity information.
Recap: ID Token Anatomy
Great job! You now understand the fundamental structure of an ID Token.
- Header: Describes the token and signing algorithm.
- Payload: Contains identity claims about the user.
- Signature: Ensures the token's integrity and authenticity.
Each part is base64url encoded and separated by dots, forming a secure and verifiable digital identity for the user.
자주 묻는 질문
“ID 토큰 구조 및 서명” 강의는 무료인가요?
네 — “ID 토큰 구조 및 서명” 전체 내용을 이 웹사이트에서 무료로 읽을 수 있습니다. 인터랙티브하게 실습하려면(내장 코드 에디터와 24/7 AI 튜터), CoddyKit PRO로 업그레이드하면 OAuth2 & OpenID Connect Deep Dive 강의 전체를 잠금 해제할 수 있습니다. OAuth2 & OpenID Connect Deep Dive 강의에는 총 4개의 강의가 포함되어 있습니다.
“ID 토큰 구조 및 서명”에서 뭘 배우나요?
ID 토큰(JWT)의 헤더, 페이로드, 서명을 분석하고 서명 방식과 포함된 정보를 이해해 보세요. 브라우저에서 직접 실행하는 실습 코드로 OAuth2 & OpenID Connect Deep Dive을(를) 배우며, 24/7 AI 튜터가 강의를 진행하면서 질문에 답변해줍니다.
OAuth2 & OpenID Connect Deep Dive을(를) 시작하는 데 경험이 필요한가요?
사전 경험은 필요하지 않습니다. CoddyKit의 OAuth2 & OpenID Connect Deep Dive은(는) 초급자부터 고급 학습자까지를 위해 구성되어 있으므로, 여기서 시작하거나 처음부터 시작할 수 있으며 자신의 속도대로 진행할 수 있습니다. 이것은 4개 중 1번째 강의입니다.
“ID 토큰 구조 및 서명” 강의는 얼마나 걸리나요?
대부분의 CoddyKit 강의는 약 5~10분이 소요됩니다. 각 강의는 간결하고 인터랙티브하여 꾸준한 진행이 가능하며, 웹과 앱에서 중단한 부분부터 바로 시작할 수 있습니다.
이 OAuth2 & OpenID Connect Deep Dive 강의에서 코드를 작성하고 실행할 수 있나요?
네. 모든 OAuth2 & OpenID Connect Deep Dive 강의에는 내장 코드 에디터가 포함되어 있으므로, 브라우저에서 바로 실제 코드를 작성하고 실행한 후 즉시 AI 피드백을 받을 수 있습니다 — 로컬 설정이 필요 없습니다.
이 강의의 모든 강의
- ID 토큰 구조 및 서명
- JWS 및 JWK 집합
- 토큰 폐기 및 검사
- 표준 ID 토큰 클레임 검증