jpskill.com
🛠️ 開発・MCP コミュニティ

authentication-patterns

Authentication and authorization patterns and best practices. Use when user asks to "implement authentication", "OAuth flow", "JWT tokens", "session management", "SSO setup", "API keys", "RBAC", "SAML", "passwordless auth", "multi-factor authentication", or mentions auth design patterns and security.

⚡ おすすめ: コマンド1行でインストール(60秒)

下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。

🍎 Mac / 🐧 Linux
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o authentication-patterns.zip https://jpskill.com/download/6063.zip && unzip -o authentication-patterns.zip && rm authentication-patterns.zip
🪟 Windows (PowerShell)
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/6063.zip -OutFile "$d\authentication-patterns.zip"; Expand-Archive "$d\authentication-patterns.zip" -DestinationPath $d -Force; ri "$d\authentication-patterns.zip"

完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。

💾 手動でダウンロードしたい(コマンドが難しい人向け)
  1. 1. 下の青いボタンを押して authentication-patterns.zip をダウンロード
  2. 2. ZIPファイルをダブルクリックで解凍 → authentication-patterns フォルダができる
  3. 3. そのフォルダを C:\Users\あなたの名前\.claude\skills\(Win)または ~/.claude/skills/(Mac)へ移動
  4. 4. Claude Code を再起動

⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。

🎯 このSkillでできること

下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。

📦 インストール方法 (3ステップ)

  1. 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
  2. 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
  3. 3. 展開してできたフォルダを、ホームフォルダの .claude/skills/ に置く
    • · macOS / Linux: ~/.claude/skills/
    • · Windows: %USERPROFILE%\.claude\skills\

Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。

詳しい使い方ガイドを見る →
最終更新
2026-05-17
取得日時
2026-05-17
同梱ファイル
1

📖 Skill本文(日本語訳)

※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。

認証と認可のパターン

Web、モバイル、APIアプリケーション向けの最新の認証と認可のパターンです。

認証方法

OAuth 2.0

  • サードパーティ連携の標準
  • フロー: Authorization Code, Implicit, Client Credentials, Resource Owner Password
  • 主要なプロバイダー: Google, GitHub, Facebook, Microsoft

OpenID Connect (OIDC)

  • OAuth 2.0の上に構築されたアイデンティティレイヤー
  • ユーザー情報と認証保証を提供

JWT (JSON Web Tokens)

  • ステートレスなトークンベース認証
  • 署名付きの暗号化されたクレーム
  • APIやマイクロサービスで使用

セッションベース

  • 従来のサーバーサイドセッション管理
  • サーバーレンダリングアプリケーションに適している
  • 慎重なCSRF保護が必要

パスワードレス

  • メールによるマジックリンク
  • WebAuthn/FIDO2
  • 生体認証

認可パターン

RBAC (Role-Based Access Control)

  • ユーザーをロールに割り当てる
  • ロールがパーミッションを持つ
  • 実装と理解が容易

ABAC (Attribute-Based Access Control)

  • 属性に基づいたきめ細かいパーミッション
  • より柔軟だが複雑
  • 複雑なパーミッション要件に適している

PBAC (Policy-Based Access Control)

  • コードとしてのパーミッション (AWS IAM, Terraform)
  • 非常に柔軟で監査可能
  • 委譲をサポート

セキュリティのベストプラクティス

  1. パスワードを絶対に保存しない - bcrypt, scrypt, Argon2を使用してください
  2. HTTPSのみを使用する - すべての認証トラフィックを暗号化します
  3. 安全なトークンストレージ - WebにはHTTPOnlyクッキーを使用します
  4. トークンローテーション - 定期的なリフレッシュトークンのローテーション
  5. MFA/2FA - 多要素認証
  6. 監査ログ - すべての認証イベントを追跡します
  7. レート制限 - ブルートフォース攻撃を防止します
  8. CORSの適切な設定 - クロスオリジンアクセスを制限します

一般的なアーキテクチャ

Client → Auth Provider (OAuth/JWT) → API
Client → Session Store ← API

参考文献

  • OAuth 2.0 Specification (RFC 6749)
  • OpenID Connect Core
  • JWT (RFC 7519)
  • OWASP Authentication Cheat Sheet
  • WebAuthn / FIDO2 Specification
📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開

Authentication & Authorization Patterns

Modern authentication and authorization patterns for web, mobile, and API applications.

Authentication Methods

OAuth 2.0

  • Standard for third-party integrations
  • Flows: Authorization Code, Implicit, Client Credentials, Resource Owner Password
  • Popular providers: Google, GitHub, Facebook, Microsoft

OpenID Connect (OIDC)

  • Identity layer on top of OAuth 2.0
  • Provides user information and authentication assurance

JWT (JSON Web Tokens)

  • Stateless token-based authentication
  • Encrypted claims with signature
  • Used for APIs and microservices

Session-Based

  • Traditional server-side session management
  • Better for server-rendered applications
  • Requires careful CSRF protection

Passwordless

  • Magic links via email
  • WebAuthn/FIDO2
  • Biometric authentication

Authorization Patterns

RBAC (Role-Based Access Control)

  • User assigned to roles
  • Roles have permissions
  • Simple to implement and understand

ABAC (Attribute-Based Access Control)

  • Fine-grained permissions based on attributes
  • More flexible but complex
  • Good for complex permission requirements

PBAC (Policy-Based Access Control)

  • Permission as code (AWS IAM, Terraform)
  • Highly flexible and auditable
  • Supports delegation

Security Best Practices

  1. Never store passwords - Use bcrypt, scrypt, or Argon2
  2. Use HTTPS only - All auth traffic encrypted
  3. Secure token storage - HTTPOnly cookies for web
  4. Token rotation - Regular refresh token rotation
  5. MFA/2FA - Multi-factor authentication
  6. Audit logging - Track all auth events
  7. Rate limiting - Prevent brute force attacks
  8. CORS properly - Restrict cross-origin access

Common Architecture

Client → Auth Provider (OAuth/JWT) → API
Client → Session Store ← API

References

  • OAuth 2.0 Specification (RFC 6749)
  • OpenID Connect Core
  • JWT (RFC 7519)
  • OWASP Authentication Cheat Sheet
  • WebAuthn / FIDO2 Specification