You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
📚 Sync docs from alaudadevops/connectors-operator on a87919a042d0dbaa33c7e409178f7935f6dd9777
Source: docs: add docs to explain how to use auth exactor to customize built-in reverse proxy (#315)
Author: chengjingtao
Ref: refs/heads/main
Commit: a87919a042d0dbaa33c7e409178f7935f6dd9777
This commit automatically syncs documentation changes from the source-docs repository.
🔗 View source commit: AlaudaDevops/connectors-operator@a87919a
🤖 Synced on 2025-11-18 11:06:56 UTC
Copy file name to clipboardExpand all lines: docs/en/connectors/architecture/index.mdx
+4-5Lines changed: 4 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -31,14 +31,13 @@ For example, a `Harbor ConnectorClass` can be defined to support integration wit
31
31
32
32
## Connectors Proxy
33
33
34
-
`ConnectorsProxy` is a core component that provides secure, secretless access to integrated tools within Kubernetes clusters. It acts as a proxy server, handling authentication injection and request routing to target tool.
34
+
`Connectors Proxy` is a core capability of the Connectors system that provides secure, secretless access to integrated tools. It typically operates as an HTTP service that can function as either a forward proxy or a reverse proxy for client applications.
35
35
36
-
`ConnectorsProxy` enables clients to access tool resources without direct credential handling. This approach delivers significant security benefits:
36
+
When clients access tool resources through `Connectors Proxy`, the proxy automatically injects the necessary authentication credentials into requests, enabling seamless access without requiring clients to handle credentials directly. This approach delivers a significant security benefit:
37
37
38
-
-**Secretless Access**: Eliminates the need to distribute tool credentials directly to clients by using short-lived tokens issued by ServiceAccount. This prevents credential exposure in clients like logs or environment variables.
39
-
-**Centralized Credential Management**: All tool credentials are managed centrally by connectors, and no need to distribute credentials to each client.
38
+
-**Secretless Access**: Eliminates the need to distribute tool credentials directly to clients by using short-lived tokens issued by Kubernetes. This prevents credential exposure in client environments such as logs or environment variables.
40
39
41
-
The platform supports both built-in and custom proxy implementationsto accommodate diverse tool authentication requirements.
40
+
To accommodate diverse tool authentication requirements, the platform supports both built-in and custom proxy implementations. Each `ConnectorClass` can provide its own proxy service, offering flexibility to meet specific tool authentication needs.
- `path`: Uses the `repository` value from the Connector's `auth.params`, constructing the path as `/<repository>/info/refs?service=git-upload-pack`
358
358
- `Authorization`: When the Connector is configured with a Secret, the `username` and `password` fields are Base64-encoded and included in the Basic authentication header.
When tool connectors require more complex authentication logic, you can use Rego-based authentication logic configuration.
363
363
@@ -713,11 +713,79 @@ spec:
713
713
kind: Service
714
714
name: proxy
715
715
namespace: default
716
-
uri: https://proxy.example.com
716
+
# uri: https://proxy.example.com
717
717
```
718
718
719
719
The Connector will use the proxy address to proxy the request to the ConnectorClass. [More information](./connectors_proxy.mdx)
720
720
721
+
### Using Rego to extract token from request \{#using-rego-to-extract-token-from-request}
722
+
723
+
When using the built-in reverse proxy, you can configure Rego rules using `spec.proxy.authExtractor` to extract tokens from client requests, enabling the built-in reverse proxy to validate client authentication using the extracted token.
724
+
725
+
For example:
726
+
727
+
```yaml
728
+
spec:
729
+
proxy:
730
+
authExtractor:
731
+
rego: |
732
+
package proxy
733
+
auth = {
734
+
"token": input.headers["Private-Token"][0]
735
+
}
736
+
```
737
+
738
+
Rego rules must follow these requirements:
739
+
740
+
- Rules must be defined in the `proxy` package
741
+
- Use the `auth` variable to return the token, where the token is a string type, for example: `auth = { "token": "abcd1234" }`
742
+
- If the token cannot be extracted, return an empty string, for example: `auth = { "token": "" }`
`ConnectorsProxy` is a core component that provides secure, secretless access to integrated tools within Kubernetes clusters. It acts as a proxy server, handling authentication injection and request routing to target tool.
10
+
`Connectors Proxy` is a core capability of the Connectors system that provides secure, secretless access to integrated tools. It typically operates as an HTTP service that can function as either a forward proxy or a reverse proxy for client applications.
11
11
12
-
`ConnectorsProxy` enables clients to access tool resources without direct credential handling. This approach delivers significant security benefits:
12
+
When clients access tool resources through `Connectors Proxy`, the proxy automatically injects the necessary authentication credentials into requests, enabling seamless access without requiring clients to handle credentials directly. This approach delivers a significant security benefit:
13
13
14
-
-**Secretless Access**: Eliminates the need to distribute tool credentials directly to clients by using short-lived tokens issued by ServiceAccount. This prevents credential exposure in clients like logs or environment variables.
15
-
-**Centralized Credential Management**: All tool credentials are managed centrally by connectors, and no need to distribute credentials to each client.
14
+
-**Secretless Access**: Eliminates the need to distribute tool credentials directly to clients by using short-lived tokens issued by Kubernetes. This prevents credential exposure in client environments such as logs or environment variables.
16
15
17
-
The platform supports both built-in and custom proxy implementationsto accommodate diverse tool authentication requirements.
16
+
To accommodate diverse tool authentication requirements, the platform supports both built-in and custom proxy implementations. Each `ConnectorClass` can provide its own proxy service, offering flexibility to meet specific tool authentication needs.
18
17
19
18
## Built-in Connectors Proxy
20
19
@@ -34,7 +33,7 @@ Connectors Proxy does not support the `CONNECT` method for `HTTP tunneling`. Cli
34
33
35
34
:::
36
35
37
-
### Reverse Proxy
36
+
### Reverse Proxy\{#reverse-proxy}
38
37
39
38
Clients access tools by connecting directly to the Connector Proxy Address instead of the original tool URL. The proxy:
When using the built-in HTTP reverse proxy with tools that use non-standard authentication methods, clients may be unable to provide tokens using standard Basic Auth or Bearer Token methods. Instead, they must use the tool's original credential format.
195
+
196
+
To support these custom authentication formats, you can use Rego rules to customize token extraction from client requests. This allows the built-in HTTP reverse proxy to extract and validate tokens regardless of how they are provided by the client.
197
+
198
+
For example:
199
+
200
+
```yaml
201
+
spec:
202
+
proxy:
203
+
authExtractor:
204
+
rego: |
205
+
package proxy
206
+
auth = {
207
+
"token": input.headers["Private-Token"][0]
208
+
}
209
+
```
210
+
211
+
This configuration extracts the token from the `Private-Token` header in client requests, which the proxy then uses to validate client authentication.
212
+
213
+
This approach provides significant flexibility for non-standard HTTP authentication mechanisms. Client CLIs can provide Kubernetes tokens using the tool's original credential format, and the proxy extracts the token through Rego rules to complete authentication validation.
214
+
215
+
For more detailed configuration on using Rego rules to extract tokens, see [ConnectorClass](./connectorclass.mdx#using-rego-to-extract-token-from-request).
216
+
217
+
For more about injecting authentication credentials into backend request, see [Injecting Authentication Credentials into Backend Request when using built-in Reverse Proxy](#injecting-authentication-when-using-built-in-reverse-proxy).
218
+
193
219
##### Connector Identification
194
220
195
221
The connector can be identified through different proxy address formats:
The proxy will validate the authentication token and automatically inject the `default/github` connector's authentication credentials when forwarding requests to GitHub services.
217
243
244
+
### Injecting Authentication Credentials into Backend Request when using built-in Reverse Proxy \{#injecting-authentication-when-using-built-in-reverse-proxy}
245
+
246
+
After the built-in reverse proxy validates the client request, it injects authentication credentials into the backend request based on the credential type configured in the Connector. The following injection methods are supported:
247
+
248
+
- **Basic Auth**
249
+
- **Bearer Token**
250
+
- **Custom Rego**
251
+
252
+
#### Basic Auth
253
+
254
+
When a Connector is configured with the secret type `kubernetes.io/basic-auth`, the proxy injects the credentials into the backend request headers using Basic Authentication.
255
+
256
+
#### Bearer Token
257
+
258
+
When a Connector is configured with the secret type `connectors.cpaas.io/bearer-token`, the proxy injects the credentials into the backend request headers using Bearer Token authentication.
259
+
260
+
#### Custom Rego
261
+
262
+
In addition to the standard Basic Auth and Bearer Token methods, you can use Rego rules to define custom authentication injection logic. For example:
263
+
264
+
```yaml
265
+
spec:
266
+
auth:
267
+
types:
268
+
- name: rego-auth
269
+
secretType: Opaque
270
+
generator:
271
+
rego: |
272
+
package proxy
273
+
auth = {
274
+
"position": "header",
275
+
"auth": {
276
+
"Private-Token": input.token
277
+
}
278
+
}
279
+
```
280
+
This configuration injects the token value from the connector's secret data into the `Private-Token` header of backend requests.
281
+
282
+
For more detailed configuration, see [ConnectorClass](./connectorclass.mdx#rego-based-authentication-logic-configuration).
283
+
284
+
When using custom Rego authentication, you typically need to configure `spec.proxy.authExtractor` to extract tokens from client requests, enabling the built-in HTTP reverse proxy to validate client authentication.
285
+
Simultaneously, use `spec.auth.types[].generator.rego` to inject authentication credentials into backend requests.
286
+
This combination enables support for custom authentication mechanisms when using the built-in HTTP reverse proxy.
- Support accessing tool's original API through the Connector API when the ConnectorClass provides Proxy Service capabilities. The system now supports two ways to access tool resources: using the tool's original API via Proxy Service, or using custom APIs provided for the ConnectorClass. For more details, see
- Support using Rego rules to extract tokens from client requests when using the built-in HTTP reverse proxy. Combined with the existing ability to inject authentication credentials into backend requests through Rego rules, you can now extend the built-in reverse proxy's capabilities to support tools with non-standard HTTP authentication mechanisms.
41
+
- For token extraction configuration, see [Custom Rego-based Authentication](../connectors/concepts/connectors_proxy.mdx#custom-rego-based-authentication).
42
+
- For authentication injection configuration, see [Injecting Authentication Credentials into Backend Request when using built-in Reverse Proxy](../connectors/concepts/connectors_proxy.mdx#injecting-authentication-when-using-built-in-reverse-proxy).
0 commit comments