Skip to content

Commit 0d4ce51

Browse files
committed
docs(kernel): keep the IAuthService example one-argument; show the transport argument on AuthManager
Claude-Session: https://claude.ai/code/session_016WV4d1NJYFGVi2FRztyBNo Co-authored-by: Claude <noreply@anthropic.com>
1 parent df9fea6 commit 0d4ce51

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

‎content/docs/kernel/contracts/auth-service.mdx‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,12 @@ With the shipped `plugin-auth`, a host that forwards to `handleRequest` gets:
8484
- **An optional transport argument.** The checks judge the client address from the transport the host passes. Pass the transport's peer as the second argument, `handleRequest(request, { remoteAddress })`, or declare `server.trustProxy` when the host sits behind a proxy that sets `X-Forwarded-For`. With neither, a deployment that sets `allowed_ip_ranges` answers `403 IP_NOT_ALLOWED`. The second argument belongs to the plugin's `AuthManager`; the `IAuthService` shape above is unchanged.
8585

8686
```typescript
87-
// Wire the auth service into an HTTP handler, passing the transport's peer address
88-
const response = await authService.handleRequest(request, { remoteAddress });
87+
// Wire the auth service into an HTTP handler
88+
const response = await authService.handleRequest(request);
8989
return response;
90+
91+
// With plugin-auth's AuthManager, also pass the transport's peer address
92+
const managed = await authManager.handleRequest(request, { remoteAddress });
9093
```
9194

9295
### verify

0 commit comments

Comments
 (0)