---
title: "認証・認可を実装する（エージェント用スキル） | Orchestor"
description: "JWT、OAuth2、セッション管理、RBAC を用いて、安全で拡張性のあるアクセス制御を構築します。認証・認可システムの実装、API の保護、セキュリティ問題の調査に使います。wshobson/agents が公開している「認証・認可を実装する」の使い方を確認できます。"
canonical_url: "https://www.orchestor.io/ja/skills/wshobson/agents/auth-implementation-patterns"
markdown_url: "https://www.orchestor.io/ja/skills/wshobson/agents/auth-implementation-patterns.md"
---

[c96b5f6](https://github.com/wshobson/agents/commit/c96b5f6552dba32e4492307493ee613581430715)[原文を開く](https://github.com/wshobson/agents/blob/c96b5f6552dba32e4492307493ee613581430715/plugins/developer-essentials/skills/auth-implementation-patterns/SKILL.md)

wshobson2026/11/24

原文 (選択中)

未翻訳

プレビュー (選択中)

83 行（空行を除く 60 行） · 2.61 KB原文

```yaml
name: auth-implementation-patterns
description: Master authentication and authorization patterns including JWT, OAuth2, session management, and RBAC to build secure, scalable access control systems. Use when implementing auth systems, securing APIs, or debugging security issues.
```

# Authentication & Authorization Implementation Patterns

Build secure, scalable authentication and authorization systems using industry-standard patterns and modern best practices.

## When to Use This Skill

* Implementing user authentication systems
* Securing REST or GraphQL APIs
* Adding OAuth2/social login
* Implementing role-based access control (RBAC)
* Designing session management
* Migrating authentication systems
* Debugging auth issues
* Implementing SSO or multi-tenancy

## Core Concepts

### 1\. Authentication vs Authorization

**Authentication (AuthN)**: Who are you?

* Verifying identity (username/password, OAuth, biometrics)
* Issuing credentials (sessions, tokens)
* Managing login/logout

**Authorization (AuthZ)**: What can you do?

* Permission checking
* Role-based access control (RBAC)
* Resource ownership validation
* Policy enforcement

### 2\. Authentication Strategies

**Session-Based:**

* Server stores session state
* Session ID in cookie
* Traditional, simple, stateful

**Token-Based (JWT):**

* Stateless, self-contained
* Scales horizontally
* Can store claims

**OAuth2/OpenID Connect:**

* Delegate authentication
* Social login (Google, GitHub)
* Enterprise SSO

## Detailed patterns and worked examples

Detailed pattern documentation lives in details.md. Read that file when the navigation tier above is insufficient.

## Best Practices

1. **Never Store Plain Passwords**: Always hash with bcrypt/argon2
2. **Use HTTPS**: Encrypt data in transit
3. **Short-Lived Access Tokens**: 15-30 minutes max
4. **Secure Cookies**: httpOnly, secure, sameSite flags
5. **Validate All Input**: Email format, password strength
6. **Rate Limit Auth Endpoints**: Prevent brute force attacks
7. **Implement CSRF Protection**: For session-based auth
8. **Rotate Secrets Regularly**: JWT secrets, session secrets
9. **Log Security Events**: Login attempts, failed auth
10. **Use MFA When Possible**: Extra security layer

## Common Pitfalls

* **Weak Passwords**: Enforce strong password policies
* **JWT in localStorage**: Vulnerable to XSS, use httpOnly cookies
* **No Token Expiration**: Tokens should expire
* **Client-Side Auth Checks Only**: Always validate server-side
* **Insecure Password Reset**: Use secure tokens with expiration
* **No Rate Limiting**: Vulnerable to brute force
* **Trusting Client Data**: Always validate on server

## Structured data

```json
[
  [
    {
      "@context": "https://schema.org",
      "@type": "Organization",
      "name": "Orchestor",
      "url": "https://www.orchestor.io",
      "sameAs": [
        "https://orchestor.io",
        "https://www.orchestor.io",
        "https://docs.orchestor.io"
      ],
      "@id": "https://www.orchestor.io/#organization",
      "alternateName": [
        "オーケスター"
      ],
      "logo": "https://www.orchestor.io/images/common/ogp/orchestor-ogp.png",
      "parentOrganization": {
        "@type": "Organization",
        "name": "ドットメディア株式会社",
        "url": "https://www.dotmedia.co.jp"
      }
    },
    {
      "@context": "https://schema.org",
      "@type": "WebSite",
      "url": "https://www.orchestor.io",
      "name": "Orchestor",
      "description": "Orchestor で画像・動画・音声を作り、参照素材を Remix できます。",
      "@id": "https://www.orchestor.io/#website",
      "alternateName": [
        "オーケスター"
      ],
      "inLanguage": "ja",
      "publisher": {
        "@id": "https://www.orchestor.io/#organization"
      }
    }
  ],
  {
    "@context": "https://schema.org",
    "@type": "BreadcrumbList",
    "@id": "https://www.orchestor.io/skills/wshobson/agents/auth-implementation-patterns#breadcrumb",
    "itemListElement": [
      {
        "@type": "ListItem",
        "position": 1,
        "name": "Orchestor",
        "item": "https://www.orchestor.io/"
      },
      {
        "@type": "ListItem",
        "position": 2,
        "name": "スキル",
        "item": "https://www.orchestor.io/skills"
      },
      {
        "@type": "ListItem",
        "position": 3,
        "name": "認証・認可を実装する",
        "item": "https://www.orchestor.io/skills/wshobson/agents/auth-implementation-patterns"
      }
    ]
  }
]
```

---

[Documentation index](https://www.orchestor.io/llms.txt)
