Skip to content

Commit

Permalink
docs(basic/bearer): add messages options (#486)
Browse files Browse the repository at this point in the history
  • Loading branch information
yusukebe committed Sep 11, 2024
1 parent 8be179c commit 6934488
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
4 changes: 4 additions & 0 deletions docs/middleware/builtin/basic-auth.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,10 @@ A function to handle hashing for safe comparison of passwords.

The function to verify the user.

### <Badge type="info" text="optional" /> invalidUserMessage: `string | object | MessageFunction`

`MessageFunction` is `(c: Context) => string | object | Promise<string | object>`. The custom message if the user is invalid.

## More Options

### <Badge type="info" text="optional" /> ...users: `{ username: string, password: string }[]`
Expand Down
12 changes: 12 additions & 0 deletions docs/middleware/builtin/bearer-auth.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,3 +110,15 @@ A function to handle hashing for safe comparison of authentication tokens.
### <Badge type="info" text="optional" /> verifyToken: `(token: string, c: Context) => boolean | Promise<boolean>`

The function to verify the token.

### <Badge type="info" text="optional" /> noAuthenticationHeaderMessage: `string | object | MessageFunction`

`MessageFunction` is `(c: Context) => string | object | Promise<string | object>`. The custom message if it does not have an authentication header.

### <Badge type="info" text="optional" /> invalidAuthenticationHeaderMessage: `string | object | MessageFunction`

The custom message if the authentication header is invalid.

### <Badge type="info" text="optional" /> invalidTokenMessage: `string | object | MessageFunction`

The custom message if the token is invalid.

0 comments on commit 6934488

Please sign in to comment.