Blame

d70fe3 Claude (MCP) 2026-03-20 19:52:59
[mcp] Rewrite Design/Auth for VPS/ATProto OAuth; remove AWS/WorkOS content
1
---
2
status: current
3
platform: robot.wtf (VPS)
dc5336 Claude (Dev) 2026-03-13 01:50:43
[mcp] Port PRD auth to wiki
4
---
5
d70fe3 Claude (MCP) 2026-03-20 19:52:59
[mcp] Rewrite Design/Auth for VPS/ATProto OAuth; remove AWS/WorkOS content
6
Extracted from the original wikibot.io design. AWS-specific content archived at [[Archive/AWS_Design/Auth]].
dc5336 Claude (Dev) 2026-03-13 01:50:43
[mcp] Port PRD auth to wiki
7
d70fe3 Claude (MCP) 2026-03-20 19:52:59
[mcp] Rewrite Design/Auth for VPS/ATProto OAuth; remove AWS/WorkOS content
8
See also: [[Design/VPS_Architecture]], [[Design/Data_Model]].
dc5336 Claude (Dev) 2026-03-13 01:50:43
[mcp] Port PRD auth to wiki
9
d70fe3 Claude (MCP) 2026-03-20 19:52:59
[mcp] Rewrite Design/Auth for VPS/ATProto OAuth; remove AWS/WorkOS content
10
---
dc5336 Claude (Dev) 2026-03-13 01:50:43
[mcp] Port PRD auth to wiki
11
d70fe3 Claude (MCP) 2026-03-20 19:52:59
[mcp] Rewrite Design/Auth for VPS/ATProto OAuth; remove AWS/WorkOS content
12
## Auth Overview
dc5336 Claude (Dev) 2026-03-13 01:50:43
[mcp] Port PRD auth to wiki
13
d70fe3 Claude (MCP) 2026-03-20 19:52:59
[mcp] Rewrite Design/Auth for VPS/ATProto OAuth; remove AWS/WorkOS content
14
**ATProto OAuth login** — users authenticate via their ATProto identity (Bluesky handle/DID). The platform runs a self-hosted OAuth 2.1 Authorization Server for MCP connections.
dc5336 Claude (Dev) 2026-03-13 01:50:43
[mcp] Port PRD auth to wiki
15
d70fe3 Claude (MCP) 2026-03-20 19:52:59
[mcp] Rewrite Design/Auth for VPS/ATProto OAuth; remove AWS/WorkOS content
16
Three auth paths, all converging on the same identity resolution and ACL check:
dc5336 Claude (Dev) 2026-03-13 01:50:43
[mcp] Port PRD auth to wiki
17
d70fe3 Claude (MCP) 2026-03-20 19:52:59
[mcp] Rewrite Design/Auth for VPS/ATProto OAuth; remove AWS/WorkOS content
18
1. **Browser session**: ATProto OAuth → platform issues a session JWT (signed with our RS256 key) → middleware validates JWT on each request → resolves user → checks ACL → sets Otterwiki headers.
19
2. **MCP OAuth (Claude.ai)**: Self-hosted OAuth 2.1 AS handles DCR, PKCE, token issuance, JWKS. Claude.ai discovers `/.well-known/oauth-protected-resource`, authenticates, presents access token. Per-wiki authorization in our middleware.
20
3. **Bearer token (Claude Code, API clients)**: Token in `Authorization` header → middleware hashes token, looks up in DB → resolves to user + wiki → checks ACL.
dc5336 Claude (Dev) 2026-03-13 01:50:43
[mcp] Port PRD auth to wiki
21
d70fe3 Claude (MCP) 2026-03-20 19:52:59
[mcp] Rewrite Design/Auth for VPS/ATProto OAuth; remove AWS/WorkOS content
22
The platform middleware is the single authentication boundary. Everything downstream trusts it.
dc5336 Claude (Dev) 2026-03-13 01:50:43
[mcp] Port PRD auth to wiki
23
d70fe3 Claude (MCP) 2026-03-20 19:52:59
[mcp] Rewrite Design/Auth for VPS/ATProto OAuth; remove AWS/WorkOS content
24
## MCP Auth
dc5336 Claude (Dev) 2026-03-13 01:50:43
[mcp] Port PRD auth to wiki
25
d70fe3 Claude (MCP) 2026-03-20 19:52:59
[mcp] Rewrite Design/Auth for VPS/ATProto OAuth; remove AWS/WorkOS content
26
**OAuth 2.1 (Claude.ai)**: Self-hosted AS (authlib-based) provides DCR, PKCE, AS metadata, token endpoint, and JWKS. The MCP endpoint serves `/.well-known/oauth-protected-resource` pointing to the local AS. Per-wiki authorization happens in middleware — the AS identifies the user, middleware checks wiki access. See [[Design/VPS_Architecture]] for implementation details.
dc5336 Claude (Dev) 2026-03-13 01:50:43
[mcp] Port PRD auth to wiki
27
d70fe3 Claude (MCP) 2026-03-20 19:52:59
[mcp] Rewrite Design/Auth for VPS/ATProto OAuth; remove AWS/WorkOS content
28
**Bearer token (Claude Code / API)**: Each wiki gets a unique MCP bearer token, stored as a bcrypt hash in the platform DB. The user sees the token once (at creation) and can regenerate it from the dashboard. Usage: `claude mcp add --transport http`.
dc5336 Claude (Dev) 2026-03-13 01:50:43
[mcp] Port PRD auth to wiki
29
d70fe3 Claude (MCP) 2026-03-20 19:52:59
[mcp] Rewrite Design/Auth for VPS/ATProto OAuth; remove AWS/WorkOS content
30
## ACL Model
dc5336 Claude (Dev) 2026-03-13 01:50:43
[mcp] Port PRD auth to wiki
31
32
Simple role-based model:
33
34
| Role | Read | Write | Delete | Manage ACL | Delete wiki |
35
|------|------|-------|--------|------------|-------------|
36
| viewer | yes | no | no | no | no |
37
| editor | yes | yes | yes | no | no |
38
| owner | yes | yes | yes | yes | yes |
39
d70fe3 Claude (MCP) 2026-03-20 19:52:59
[mcp] Rewrite Design/Auth for VPS/ATProto OAuth; remove AWS/WorkOS content
40
Wiki creator is always owner. Owners can grant viewer/editor access to other registered users.
dc5336 Claude (Dev) 2026-03-13 01:50:43
[mcp] Port PRD auth to wiki
41
d70fe3 Claude (MCP) 2026-03-20 19:52:59
[mcp] Rewrite Design/Auth for VPS/ATProto OAuth; remove AWS/WorkOS content
42
## Authorization Flow
dc5336 Claude (Dev) 2026-03-13 01:50:43
[mcp] Port PRD auth to wiki
43
44
**Layer 1 — Platform middleware** (before Otterwiki sees the request):
45
46
1. Resolve user identity from JWT or bearer token
d70fe3 Claude (MCP) 2026-03-20 19:52:59
[mcp] Rewrite Design/Auth for VPS/ATProto OAuth; remove AWS/WorkOS content
47
2. Resolve wiki from request routing
dc5336 Claude (Dev) 2026-03-13 01:50:43
[mcp] Port PRD auth to wiki
48
3. Look up ACL: does this user have a grant on this wiki?
49
4. If no grant and wiki is not public → 403
d70fe3 Claude (MCP) 2026-03-20 19:52:59
[mcp] Rewrite Design/Auth for VPS/ATProto OAuth; remove AWS/WorkOS content
50
5. Map ACL role to Otterwiki permission headers:
dc5336 Claude (Dev) 2026-03-13 01:50:43
[mcp] Port PRD auth to wiki
51
52
| ACL role | `x-otterwiki-permissions` header |
53
|----------|----------------------------------|
54
| viewer | `READ` |
55
| editor | `READ,WRITE,UPLOAD` |
56
| owner | `READ,WRITE,UPLOAD,ADMIN` |
57
| anonymous (public wiki) | Synthetic user with `READ` only |
58
d70fe3 Claude (MCP) 2026-03-20 19:52:59
[mcp] Rewrite Design/Auth for VPS/ATProto OAuth; remove AWS/WorkOS content
59
6. Set headers: `x-otterwiki-email`, `x-otterwiki-name`, `x-otterwiki-permissions`
60
7. Forward to Otterwiki
dc5336 Claude (Dev) 2026-03-13 01:50:43
[mcp] Port PRD auth to wiki
61
62
**Layer 2 — Otterwiki** (`AUTH_METHOD=PROXY_HEADER`):
63
64
- Reads headers, creates ephemeral user object per request
65
- No local user database — all identity comes from headers
66
- Enforces READ/WRITE/UPLOAD/ADMIN based on the permissions header
67
68
**For MCP and API paths**, Otterwiki is not involved in auth — the handlers read the git repo directly. Authorization happens entirely in Layer 1.
69
d70fe3 Claude (MCP) 2026-03-20 19:52:59
[mcp] Rewrite Design/Auth for VPS/ATProto OAuth; remove AWS/WorkOS content
70
### Public wiki access
dc5336 Claude (Dev) 2026-03-13 01:50:43
[mcp] Port PRD auth to wiki
71
d70fe3 Claude (MCP) 2026-03-20 19:52:59
[mcp] Rewrite Design/Auth for VPS/ATProto OAuth; remove AWS/WorkOS content
72
The platform middleware injects a synthetic anonymous user with READ permission for public wikis. Otterwiki config stays identical for all wikis:
dc5336 Claude (Dev) 2026-03-13 01:50:43
[mcp] Port PRD auth to wiki
73
74
```python
75
AUTH_METHOD = "PROXY_HEADER"
76
READ_ACCESS = "APPROVED" # always — public access handled by middleware
77
WRITE_ACCESS = "APPROVED"
78
ATTACHMENT_ACCESS = "APPROVED"
79
DISABLE_REGISTRATION = True # no Otterwiki-level registration
80
```
81
d70fe3 Claude (MCP) 2026-03-20 19:52:59
[mcp] Rewrite Design/Auth for VPS/ATProto OAuth; remove AWS/WorkOS content
82
## Otterwiki Admin Panel — Section Disposition
dc5336 Claude (Dev) 2026-03-13 01:50:43
[mcp] Port PRD auth to wiki
83
d70fe3 Claude (MCP) 2026-03-20 19:52:59
[mcp] Rewrite Design/Auth for VPS/ATProto OAuth; remove AWS/WorkOS content
84
The wiki owner (ACL role `owner`) gets `ADMIN` permission → access to `/-/admin/*`.
dc5336 Claude (Dev) 2026-03-13 01:50:43
[mcp] Port PRD auth to wiki
85
d70fe3 Claude (MCP) 2026-03-20 19:52:59
[mcp] Rewrite Design/Auth for VPS/ATProto OAuth; remove AWS/WorkOS content
86
| Admin section | Disposition | Reason |
87
|--------------|-------------|--------|
88
| Application Preferences | **Keep** | Wiki branding: site name, description, logo, favicon, language |
89
| Sidebar Preferences | **Keep** | UI layout: sidebar shortcuts, custom menu items |
90
| Content and Editing | **Keep** | Git workflow: commit message mode/template, page name casing, WikiLink style |
91
| Repository Management | **Disable** | Conflicts with platform Git management |
92
| Permissions and Registration | **Disable** | Conflicts with platform auth (middleware-managed) |
93
| User Management | **Disable** | No local user database in ProxyHeaderAuth mode |
94
| Mail Preferences | **Disable for MVP** | SMTP notifications — revisit later |
dc5336 Claude (Dev) 2026-03-13 01:50:43
[mcp] Port PRD auth to wiki
95
d70fe3 Claude (MCP) 2026-03-20 19:52:59
[mcp] Rewrite Design/Auth for VPS/ATProto OAuth; remove AWS/WorkOS content
96
**Implementation**: Override admin navigation template to hide disabled sections. Return 404 from disabled routes in middleware (defense in depth).