OAuth 2.0과 OpenID Connect
애플리케이션에서 인증(OAuth 2.0)과 인증(OpenID Connect)을 위해 업계 표준 프로토콜을 이해하고 안전하게 통합합니다.
OAuth 2.0과 OpenID Connect은(는) CoddyKit의 무료 Secure Coding & OWASP Top 10 for Backend 강의입니다. 이것은 4개 중 2번째 강의입니다. 아래에서 전체 강의를 무료로 읽을 수 있으며, 내장 코드 에디터와 24/7 AI 튜터와 함께 브라우저에서 직접 실습할 수 있습니다. 이 강의는 Secure Coding & OWASP Top 10 for Backend 학습 경로의 일부이며, 진행 상황이 웹과 CoddyKit 앱에 동기화됩니다. Secure Coding & OWASP Top 10 for Backend 강의에는 총 4개의 강의가 포함되어 있습니다.
이 강의의 일부는 아직 번역되지 않았으며 영어로 표시됩니다.
What is OAuth 2.0?
Welcome! In this lesson, we'll dive into OAuth 2.0 and OpenID Connect, two crucial protocols for modern web security.
First, let's understand OAuth 2.0. It's an industry-standard protocol for authorization. Think of it as a way to grant an application limited access to a user's resources without giving away their password.
- Authorization: Granting permission to do something.
- Authentication: Verifying who someone is.
OAuth 2.0 is NOT for authentication by itself, but it's often confused!
Who's Who in OAuth 2.0
OAuth 2.0 involves four key roles working together:
- Resource Owner: The user who owns the protected data (e.g., their photos on Google).
- Client: The application requesting access to the user's resources (e.g., a photo printing app).
- Authorization Server: The server that issues access tokens to the client after the resource owner's consent (e.g., Google's auth server).
- Resource Server: The server hosting the protected resources, capable of accepting access tokens (e.g., Google Photos API).
Understanding these roles is key to grasping the flow.
The Authorization Code Flow
OAuth 2.0 defines several ways (called 'grant types') for a client to get an access token. The Authorization Code Flow is the most common and secure for web applications.
It's a multi-step process designed to keep sensitive credentials (like your password) away from the client application and directly between you and the Authorization Server.
Let's break down how this secure flow works step-by-step.
Auth Flow: Step 1 (Request)
It all starts when the Client application needs to access a user's protected resources (like their calendar). The client redirects the Resource Owner's browser to the Authorization Server.
This redirect includes:
- The client's ID (
client_id) - The type of access requested (
scope, e.g.,read:calendar) - Where to send the user back (
redirect_uri)
The user is now interacting directly with the Authorization Server.
Auth Flow: Step 2 (Consent & Code)
At the Authorization Server, the Resource Owner (you!) is prompted to log in (if not already) and then asked if they grant the Client application the requested permissions.
If permission is granted, the Authorization Server redirects the user's browser back to the Client's pre-registered redirect_uri. This redirect includes a temporary, single-use authorization code.
This code is short-lived and doesn't grant access by itself.
Auth Flow: Step 3 (Token Exchange)
Now, the Client application has the authorization code. It then makes a direct, server-to-server request to the Authorization Server's token endpoint.
In this request, the client exchanges the authorization code for:
- An Access Token
- Optionally, a Refresh Token
This direct communication ensures the client's secret (if it has one) and the tokens are never exposed in the browser.
Access & Refresh Tokens
After the exchange, the Client holds two important tokens:
- Access Token: This is the actual credential used to access the Resource Server. It's usually short-lived (minutes to hours) and contains 'scopes' defining what the client can do.
- Refresh Token: This is a long-lived credential used by the client to obtain a new access token when the current one expires, without needing the user to re-authenticate. It must be stored securely by the client!
The client uses the Access Token to make requests to the Resource Server.
Beyond Authorization: OpenID Connect
While OAuth 2.0 is great for authorization, it doesn't directly provide user authentication. That's where OpenID Connect (OIDC) comes in!
OIDC is an identity layer built on top of OAuth 2.0. It allows clients to verify the identity of the Resource Owner (the user) and get basic profile information.
Think of it as adding a 'who are you?' layer to the 'what can you do?' of OAuth.
ID Tokens and Claims
The core of OIDC is the ID Token. This is a JSON Web Token (JWT) that contains claims about the authenticated user.
Common claims include:
sub(subject): Unique identifier for the user.name: User's full name.email: User's email address.iss(issuer): The URL of the OIDC provider.aud(audience): The client ID for which the token is intended.
The client verifies the ID Token's signature to ensure its authenticity and integrity.
Quick Check: OAuth vs. OIDC
Let's quickly test your understanding of the core concepts we've covered.
Recap: OAuth & OIDC
Great job! You've learned the fundamentals of OAuth 2.0 and OpenID Connect.
- OAuth 2.0 is an authorization framework, allowing delegated access to resources.
- It involves a Resource Owner, Client, Authorization Server, and Resource Server.
- The Authorization Code Flow is the most secure for web apps.
- OpenID Connect builds on OAuth 2.0 to provide an identity layer for user authentication.
- ID Tokens (JWTs) carry user identity claims, while Access Tokens grant resource access.
Understanding these protocols is vital for building secure and modern applications!
자주 묻는 질문
“OAuth 2.0과 OpenID Connect” 강의는 무료인가요?
네 — “OAuth 2.0과 OpenID Connect” 전체 내용을 이 웹사이트에서 무료로 읽을 수 있습니다. 인터랙티브하게 실습하려면(내장 코드 에디터와 24/7 AI 튜터), CoddyKit PRO로 업그레이드하면 Secure Coding & OWASP Top 10 for Backend 강의 전체를 잠금 해제할 수 있습니다. Secure Coding & OWASP Top 10 for Backend 강의에는 총 4개의 강의가 포함되어 있습니다.
“OAuth 2.0과 OpenID Connect”에서 뭘 배우나요?
애플리케이션에서 인증(OAuth 2.0)과 인증(OpenID Connect)을 위해 업계 표준 프로토콜을 이해하고 안전하게 통합합니다. 브라우저에서 직접 실행하는 실습 코드로 Secure Coding & OWASP Top 10 for Backend을(를) 배우며, 24/7 AI 튜터가 강의를 진행하면서 질문에 답변해줍니다.
Secure Coding & OWASP Top 10 for Backend을(를) 시작하는 데 경험이 필요한가요?
사전 경험은 필요하지 않습니다. CoddyKit의 Secure Coding & OWASP Top 10 for Backend은(는) 초급자부터 고급 학습자까지를 위해 구성되어 있으므로, 여기서 시작하거나 처음부터 시작할 수 있으며 자신의 속도대로 진행할 수 있습니다. 이것은 4개 중 2번째 강의입니다.
“OAuth 2.0과 OpenID Connect” 강의는 얼마나 걸리나요?
대부분의 CoddyKit 강의는 약 5~10분이 소요됩니다. 각 강의는 간결하고 인터랙티브하여 꾸준한 진행이 가능하며, 웹과 앱에서 중단한 부분부터 바로 시작할 수 있습니다.
이 Secure Coding & OWASP Top 10 for Backend 강의에서 코드를 작성하고 실행할 수 있나요?
네. 모든 Secure Coding & OWASP Top 10 for Backend 강의에는 내장 코드 에디터가 포함되어 있으므로, 브라우저에서 바로 실제 코드를 작성하고 실행한 후 즉시 AI 피드백을 받을 수 있습니다 — 로컬 설정이 필요 없습니다.
이 강의의 모든 강의
- 다중 요소 인증(MFA)
- OAuth 2.0과 OpenID Connect
- JWT 보안과 모범 사례
- 안전한 비밀번호 저장 및 자격 증명 복구