본문으로 건너뛰기
Skillpedia
보안35k · #7763

configuring-oauth2-authorization-flow

하는 일

이 도구는 애플리케이션과 서비스가 OAuth 2.0이라는 방식을 사용해 다른 서비스와 안전하게 연결하는 방법을 설정하도록 돕습니다. 올바른 애플리케이션만 올바른 정보에 접근하도록 보장합니다.

사용하는 경우

  • ✓다른 서비스의 데이터에 접근해야 하는 새 앱을 만들 때.
  • ✓기존 애플리케이션의 보안을 개선할 때.
  • ✓서로 다른 컴퓨터 시스템이 안전하게 통신하도록 설정하는 경우.

스킬 링크

https://github.com/mukul975/Anthropic-Cybersecurity-Skills/blob/main/skills/configuring-oauth2-authorization-flow/SKILL.md

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/mukul975/Anthropic-Cybersecurity-Skills/blob/main/skills/configuring-oauth2-authorization-flow/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“PKCE를 사용해 제 모바일 앱의 OAuth 2.0 인증 흐름을 설정해 주세요.”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

애플리케이션이 데이터 접근 권한을 요청하는 단계를 정의합니다. 여기에는 연결이 안전하고 승인되었는지 확인하기 위해 비밀 코드와 토큰을 주고받는 과정이 포함됩니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.

Configuring OAuth 2.0 Authorization Flow

Overview

Configure secure OAuth 2.0 authorization flows including Authorization Code with PKCE, Client Credentials, and Device Authorization Grant. This skill covers flow selection, PKCE implementation, token lifecycle management, scope design, and alignment with OAuth 2.1 security requirements.

When to Use

  • When deploying or configuring configuring oauth2 authorization flow capabilities in your environment
  • When establishing security controls aligned to compliance requirements
  • When building or improving security architecture for this domain
  • When conducting security assessments that require this implementation

Prerequisites

  • Familiarity with identity access management concepts and tools
  • Access to a test or lab environment for safe execution
  • Python 3.8+ with required dependencies installed
  • Appropriate authorization for any testing activities

Objectives

  • Implement Authorization Code flow with PKCE for public and confidential clients
  • Configure Client Credentials flow for machine-to-machine communication
  • Design least-privilege scope hierarchies
  • Implement secure token storage, refresh, and revocation
  • Apply OAuth 2.1 best practices and RFC 9700 security recommendations
  • Validate token integrity and prevent common OAuth attacks

Key Concepts

OAuth 2.0 Grant Types

  1. Authorization Code + PKCE: Recommended for all client types (web, mobile, SPA). PKCE is mandatory in OAuth 2.1.
  2. Client Credentials: Machine-to-machine authentication without user context.
  3. Device Authorization Grant (RFC 8628): For input-constrained devices (smart TVs, CLI tools).
  4. Refresh Token: Long-lived token to obtain new access tokens without re-authentication.

PKCE (Proof Key for Code Exchange)

PKCE (RFC 7636) prevents authorization code interception attacks:

  1. Client generates random code_verifier (43-128 characters, unreserved URI chars)
  2. Client computes code_challenge = BASE64URL(SHA256(code_verifier))
  3. Authorization request includes code_challenge and code_challenge_method=S256
  4. Token request includes original code_verifier
  5. Server validates SHA256(code_verifier) matches stored code_challenge

Token Types

  • Access Token: Short-lived (5-60 min), bearer or DPoP-bound
  • Refresh Token: Long-lived, single-use with rotation
  • ID Token (OIDC): JWT containing user identity claims

Workflow

Step 1: Authorization Code Flow with PKCE

  1. Generate cryptographically random code_verifier (min 43 chars)
  2. Compute code_challenge using S256 method
  3. Redirect user to authorization endpoint with parameters:
    • response_type=code
    • client_id, redirect_uri, scope, state
    • code_challenge, code_challenge_method=S256
  4. User authenticates and consents
  5. Authorization server redirects with authorization code
  6. Exchange code + code_verifier for tokens at token endpoint
  7. Validate state parameter matches original value

Step 2: Scope Design

  • Define granular scopes: read:users, write:orders, admin:settings
  • Follow least-privilege: request minimum scopes needed
  • Implement scope validation on resource server
  • Document scope hierarchy and consent requirements

Step 3: Token Security

  • Store tokens securely (httpOnly cookies for web, keychain for mobile)
  • Implement token refresh with rotation (one-time-use refresh tokens)
  • Set appropriate expiration: access tokens 5-15 min, refresh tokens 8-24 hrs
  • Enable DPoP (Demonstration of Proof-of-Possession) for sender-constrained tokens
  • Implement token revocation endpoint

Step 4: Client Credentials Flow

  1. Register service client with client_id and client_secret
  2. Request token: POST /oauth/token with grant_type=client_credentials
  3. Include scope for required permissions
  4. Store client_secret securely (vault, env vars, not code)
  5. Implement certificate-based client authentication for higher assurance

Step 5: Security Hardening

  • Enforce PKCE for all authorization code flows
  • Use exact redirect URI matching (no wildcards)
  • Implement CSRF protection with state parameter
  • Enable refresh token rotation and revocation on reuse detection
  • Apply RFC 9700 security best practices
  • Block implicit grant and ROPC (removed in OAuth 2.1)

Security Controls

Control NIST 800-53 Description
Access Control AC-3 Token-based access enforcement

…

자주 묻는 질문

OAuth 2.0이란 무엇인가요?

비밀번호를 공유하지 않고도, 애플리케이션이 사용자를 대신해 다른 서비스의 자원에 접근할 수 있게 하는 보안 표준입니다.

PKCE란 무엇인가요?

OAuth 2.0을 위한 추가 보안 계층으로, 특히 모바일과 웹 앱에서 인증 코드가 훔쳐지는 것을 막아 줍니다.

'토큰'이란 무엇인가요?

애플리케이션이 무언가에 접근할 권한이 있음을 증명하는 데 쓰는, 수명이 짧은 디지털 출입증과 같습니다.

상세 정보

작성자의 원본 설명

Configures secure OAuth 2.0 authorization flows, including Authorization Code with PKCE, Client Credentials, and Device Authorization Grant, covering flow selection, PKCE implementation, token lifecycle management, and scope design per OAuth 2.1. Use when implementing or hardening OAuth 2.0 authentication/authorization for web, mobile, SPA, or machine-to-machine clients.

repo: mukul975/Anthropic-Cybersecurity-Skills

인기도

GitHub 스타
35k
순위
#7763
라이선스
Apache-2.0
업데이트
2026. 8. 31.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬