Skip to content

Commit 518c3a0

Browse files
committed
update docs
1 parent c33bb49 commit 518c3a0

File tree

1 file changed

+92
-16
lines changed
  • docs/en/documentation/configuration/authentication

1 file changed

+92
-16
lines changed

docs/en/documentation/configuration/authentication/generic.md

Lines changed: 92 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -19,34 +19,105 @@ your client ID or the intended audience for the token), the
1919
`authorizationServer` of your identity provider, and optionally a list of
2020
`scopesRequired` that must be present in the token's claims.
2121

22-
## Behavior
22+
## Usage Modes
2323

24-
### Token Validation
24+
The Generic Auth Service supports two distinct modes of operation:
2525

26-
When a request is received, the service will:
26+
### 1. Toolbox Auth
2727

28-
1. Extract the token from the `<name>_token` header (e.g.,
29-
`my-generic-auth_token`).
30-
2. Fetch the JWKS from the configured `authorizationServer` (caching it in the
31-
background) to verify the token's signature.
32-
3. Validate that the token is not expired and its signature is valid.
33-
4. Verify that the `aud` (audience) claim matches the configured `audience`.
34-
claim contains all required scopes.
35-
5. Return the validated claims to be used for [Authenticated
36-
Parameters][auth-params] or [Authorized Invocations][auth-invoke].
28+
This mode is used for Toolbox's native authentication/authorization features. It
29+
is active when you reference the auth service in a tool's configuration and
30+
`mcpEnabled` is set to false.
3731

38-
[auth-invoke]: ../tools/_index.md#authorized-invocations
39-
[auth-params]: ../tools/_index.md#authenticated-parameters
32+
- **Header**: Expects the token in a custom header matching `<name>_token`
33+
(e.g., `my-generic-auth_token`).
34+
- **Token Type**: Only supports **JWT** (OIDC) tokens.
35+
- **Usage**: Used for [Authenticated Parameters][auth-params] and [Authorized
36+
Invocations][auth-invoke].
37+
38+
#### Token Validation
39+
40+
When a request is received in this mode, the service will:
4041

41-
## Example
42+
1. Extract the token from the `<name>_token` header.
43+
2. Treat it as a JWT (opaque tokens are not supported in this mode).
44+
3. Validates signature using JWKS fetched from `authorizationServer`.
45+
4. Verifies expiration (`exp`) and audience (`aud`).
46+
5. Verifies required scopes in `scope` claim.
47+
48+
#### Example
4249

4350
```yaml
4451
kind: authServices
4552
name: my-generic-auth
4653
type: generic
4754
audience: ${YOUR_OIDC_AUDIENCE}
4855
authorizationServer: https://your-idp.example.com
49-
mcpEnabled: false
56+
# mcpEnabled: false
57+
scopesRequired:
58+
- read
59+
- write
60+
```
61+
62+
#### Tool Usage Example
63+
64+
To use this auth service for **Authenticated Parameters** or **Authorized
65+
Invocations**, reference it in your tool configuration:
66+
67+
```yaml
68+
kind: tool
69+
name: secure_query
70+
type: postgres-sql
71+
source: my-pg-instance
72+
statement: |
73+
SELECT * FROM data WHERE user_id = $1
74+
parameters:
75+
- name: user_id
76+
type: strings
77+
description: Auto-populated from token
78+
authServices:
79+
- name: my-generic-auth
80+
field: sub # Extract 'sub' claim from JWT
81+
authRequired:
82+
- my-generic-auth # Require valid token for invocation
83+
```
84+
85+
### 2. MCP Authorization
86+
87+
This mode enforces global authentication for all MCP endpoints. It is active
88+
when `mcpEnabled` is set to `true` in the auth service configuration.
89+
90+
- **Header**: Expects the token in the standard `Authorization: Bearer <token>`
91+
header.
92+
- **Token Type**: Supports both **JWT** and **Opaque** tokens.
93+
- **Usage**: Used to secure the entire MCP server.
94+
95+
#### Token Validation
96+
97+
When a request is received in this mode, the service will:
98+
99+
1. Extract the token from the `Authorization` header after `Bearer ` prefix.
100+
2. Determine if the token is a JWT or an opaque token based on format (JWTs
101+
contain exactly two dots).
102+
3. For **JWTs**:
103+
- Validates signature using JWKS fetched from `authorizationServer`.
104+
- Verifies expiration (`exp`) and audience (`aud`).
105+
- Verifies required scopes in `scope` claim.
106+
4. For **Opaque Tokens**:
107+
- Calls the introspection endpoint (`<authorizationServer>/introspect`).
108+
- Verifies that the token is `active`.
109+
- Verifies expiration (`exp`) and audience (`client_id`).
110+
- Verifies required scopes in `scope` field.
111+
112+
#### Example
113+
114+
```yaml
115+
kind: authServices
116+
name: my-generic-auth
117+
type: generic
118+
audience: ${YOUR_TOKEN_AUDIENCE}
119+
authorizationServer: https://your-idp.example.com
120+
mcpEnabled: true
50121
scopesRequired:
51122
- read
52123
- write
@@ -56,6 +127,11 @@ scopesRequired:
56127
${ENV_NAME} instead of hardcoding your secrets into the configuration file.
57128
{{< /notice >}}
58129

130+
[auth-invoke]: ../tools/_index.md#authorized-invocations
131+
[auth-params]: ../tools/_index.md#authenticated-parameters
132+
[mcp-auth]:
133+
https://modelcontextprotocol.io/specification/2025-11-25/basic/authorization
134+
59135
## Reference
60136

61137
| **field** | **type** | **required** | **description** |

0 commit comments

Comments
 (0)