Skip to content

Commit 7c8b153

Browse files
committed
docs(middleware): route auth failures through central error handler
- Reword basic-auth 401 to flow through the central handler - Reword csrf 403 to flow through the central handler - Reword ip 403 to flow through the central handler
1 parent e6ea3ad commit 7c8b153

6 files changed

Lines changed: 6 additions & 6 deletions

File tree

docs/id/middleware/basic-auth.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ router.use(
103103

104104
## Penanganan Error
105105

106-
Login yang gagal mengembalikan **401 Unauthorized** dengan header `WWW-Authenticate: Basic realm="Secure Area"`, yang membuat browser menampilkan prompt login. Kredensial diperiksa dalam waktu konstan untuk menghindari kebocoran timing, dan array `users` kosong melempar `Deno.errors.InvalidData` saat middleware dibuat. Untuk membentuk response 401, daftarkan satu handler dengan [`router.catch()`](/id/error-handling/object-details), atau andalkan [perilaku default](/id/error-handling/default-behavior).
106+
Login yang gagal menghasilkan **401 Unauthorized** dan header `WWW-Authenticate: Basic realm="Secure Area"`, yang membuat browser menampilkan prompt login. Kredensial diperiksa dalam waktu konstan untuk menghindari kebocoran timing, dan array `users` kosong melempar `Deno.errors.InvalidData` saat middleware dibuat. Response 401 dialirkan ke [error handler terpusat](/id/error-handling/object-details), jadi bentuk response di sana atau andalkan [perilaku default](/id/error-handling/default-behavior).
107107

108108
## Autentikasi Browser
109109

docs/id/middleware/csrf.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,6 @@ type CsrfRulePredicate = (value: string, ctx: Context) => boolean
100100
101101
## Penanganan Error
102102
103-
Ketika request diblokir, middleware mengembalikan pesan `Request blocked by CSRF protection` dengan **status code 403**. Untuk membentuk response itu, daftarkan satu handler dengan [`router.catch()`](/id/error-handling/object-details), atau andalkan [perilaku default](/id/error-handling/default-behavior).
103+
Ketika request diblokir, middleware menghasilkan **403** dan pesan `Request blocked by CSRF protection`. Kegagalan itu dialirkan ke [error handler terpusat](/id/error-handling/object-details), jadi bentuk response di sana atau andalkan [perilaku default](/id/error-handling/default-behavior).
104104
105105
Aturan `origin` atau `secFetchSite` kustom yang melempar gagal pemeriksaannya sendiri dan jatuh aman ke penolakan, dan kesalahannya muncul sebagai event [`csrf:rule-error`](/id/middleware/observability/events#middleware) yang menyebut aturan mana yang rusak alih-alih tetap tersembunyi.

docs/id/middleware/ip.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,4 +79,4 @@ Middleware membaca IP klien yang diresolusi dari `ctx.ip`. Di balik proxy, atur
7979

8080
## Penanganan Error
8181

82-
Ketika request ditolak, middleware mengembalikan pesan `Access denied by IP restriction` dengan **status code 403**. Untuk membentuk response itu, daftarkan satu handler dengan [`router.catch()`](/id/error-handling/object-details), atau andalkan [perilaku default](/id/error-handling/default-behavior).
82+
Ketika request ditolak, middleware menghasilkan **403** dan pesan `Access denied by IP restriction`. Kegagalan itu dialirkan ke [error handler terpusat](/id/error-handling/object-details), jadi bentuk response di sana atau andalkan [perilaku default](/id/error-handling/default-behavior).

docs/middleware/basic-auth.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ router.use(
103103

104104
## Error Handling
105105

106-
A failed login returns **401 Unauthorized** with a `WWW-Authenticate: Basic realm="Secure Area"` header, which is what makes browsers show the login prompt. Credentials are checked in constant time to avoid timing leaks, and an empty `users` array throws `Deno.errors.InvalidData` when the middleware is created. To shape the 401 response, register a single handler with [`router.catch()`](/error-handling/object-details), or rely on the [default behavior](/error-handling/default-behavior).
106+
A failed login fails with **401 Unauthorized** and a `WWW-Authenticate: Basic realm="Secure Area"` header, which is what makes browsers show the login prompt. Credentials are checked in constant time to avoid timing leaks, and an empty `users` array throws `Deno.errors.InvalidData` when the middleware is created. The 401 routes through the [central error handler](/error-handling/object-details), so shape the response there or rely on the [default behavior](/error-handling/default-behavior).
107107

108108
## Browser Authentication
109109

docs/middleware/csrf.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,6 @@ type CsrfRulePredicate = (value: string, ctx: Context) => boolean
100100
101101
## Error Handling
102102
103-
When a request is blocked, the middleware returns message `Request blocked by CSRF protection` with **status code 403**. To shape that response, register a single handler with [`router.catch()`](/error-handling/object-details), or rely on the [default behavior](/error-handling/default-behavior).
103+
When a request is blocked, the middleware fails with **403** and message `Request blocked by CSRF protection`. That failure routes through the [central error handler](/error-handling/object-details), so shape the response there or rely on the [default behavior](/error-handling/default-behavior).
104104
105105
A custom `origin` or `secFetchSite` rule that throws fails its own check and falls safe to a refusal, and the fault surfaces as a [`csrf:rule-error`](/middleware/observability/events#middleware) event naming which rule broke instead of staying hidden.

docs/middleware/ip.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,4 +85,4 @@ The middleware reads the resolved client IP from `ctx.ip`. Behind a proxy, confi
8585

8686
## Error Handling
8787

88-
When a request is denied, the middleware returns message `Access denied by IP restriction` with **status code 403**. To shape that response, register a single handler with [`router.catch()`](/error-handling/object-details), or rely on the [default behavior](/error-handling/default-behavior).
88+
When a request is denied, the middleware fails with **403** and message `Access denied by IP restriction`. That failure routes through the [central error handler](/error-handling/object-details), so shape the response there or rely on the [default behavior](/error-handling/default-behavior).

0 commit comments

Comments
 (0)