Skip to content

Commit 90f4c20

Browse files
committed
LCORE-429: add docs on configuring authentication
Signed-off-by: Haoyu Sun <hasun@redhat.com>
1 parent c8175a8 commit 90f4c20

File tree

1 file changed

+114
-33
lines changed

1 file changed

+114
-33
lines changed

README.md

Lines changed: 114 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -13,39 +13,48 @@ Lightspeed Core Stack (LCS) is an AI-powered assistant that provides answers to
1313

1414
<!-- vim-markdown-toc GFM -->
1515

16-
* [Architecture](#architecture)
17-
* [Prerequisites](#prerequisites)
18-
* [Installation](#installation)
19-
* [Configuration](#configuration)
20-
* [Integration with Llama Stack](#integration-with-llama-stack)
21-
* [Llama Stack as separate server](#llama-stack-as-separate-server)
22-
* [Llama Stack project and configuration](#llama-stack-project-and-configuration)
23-
* [Check connection to Llama Stack](#check-connection-to-llama-stack)
24-
* [Llama Stack as client library](#llama-stack-as-client-library)
25-
* [System prompt](#system-prompt)
26-
* [Safety Shields](#safety-shields)
27-
* [Usage](#usage)
28-
* [Make targets](#make-targets)
29-
* [Running Linux container image](#running-linux-container-image)
30-
* [Endpoints](#endpoints)
31-
* [OpenAPI specification](#openapi-specification)
32-
* [Readiness Endpoint](#readiness-endpoint)
33-
* [Liveness Endpoint](#liveness-endpoint)
34-
* [Publish the service as Python package on PyPI](#publish-the-service-as-python-package-on-pypi)
35-
* [Generate distribution archives to be uploaded into Python registry](#generate-distribution-archives-to-be-uploaded-into-python-registry)
36-
* [Upload distribution archives into selected Python registry](#upload-distribution-archives-into-selected-python-registry)
37-
* [Packages on PyPI and Test PyPI](#packages-on-pypi-and-test-pypi)
38-
* [Contributing](#contributing)
39-
* [Testing](#testing)
40-
* [License](#license)
41-
* [Additional tools](#additional-tools)
42-
* [Utility to generate OpenAPI schema](#utility-to-generate-openapi-schema)
43-
* [Path](#path)
44-
* [Usage](#usage-1)
45-
* [Data Collector Service](#data-collector-service)
46-
* [Features](#features)
47-
* [Configuration](#configuration-1)
48-
* [Running the Service](#running-the-service)
16+
- [lightspeed-stack](#lightspeed-stack)
17+
- [About The Project](#about-the-project)
18+
- [Architecture](#architecture)
19+
- [Prerequisites](#prerequisites)
20+
- [Installation](#installation)
21+
- [Configuration](#configuration)
22+
- [Integration with Llama Stack](#integration-with-llama-stack)
23+
- [Llama Stack as separate server](#llama-stack-as-separate-server)
24+
- [Llama Stack project and configuration](#llama-stack-project-and-configuration)
25+
- [Check connection to Llama Stack](#check-connection-to-llama-stack)
26+
- [Llama Stack as client library](#llama-stack-as-client-library)
27+
- [System prompt](#system-prompt)
28+
- [Safety Shields](#safety-shields)
29+
- [Authentication](#authentication)
30+
- [K8s based authentication](#k8s-based-authentication)
31+
- [JSON Web Keyset based authentication](#json-web-keyset-based-authentication)
32+
- [No-op authentication](#no-op-authentication)
33+
- [Usage](#usage)
34+
- [Make targets](#make-targets)
35+
- [Running Linux container image](#running-linux-container-image)
36+
- [Endpoints](#endpoints)
37+
- [OpenAPI specification](#openapi-specification)
38+
- [Readiness Endpoint](#readiness-endpoint)
39+
- [Liveness Endpoint](#liveness-endpoint)
40+
- [Publish the service as Python package on PyPI](#publish-the-service-as-python-package-on-pypi)
41+
- [Generate distribution archives to be uploaded into Python registry](#generate-distribution-archives-to-be-uploaded-into-python-registry)
42+
- [Upload distribution archives into selected Python registry](#upload-distribution-archives-into-selected-python-registry)
43+
- [Packages on PyPI and Test PyPI](#packages-on-pypi-and-test-pypi)
44+
- [Contributing](#contributing)
45+
- [Testing](#testing)
46+
- [License](#license)
47+
- [Additional tools](#additional-tools)
48+
- [Utility to generate OpenAPI schema](#utility-to-generate-openapi-schema)
49+
- [Path](#path)
50+
- [Usage](#usage-1)
51+
- [Data Collector Service](#data-collector-service)
52+
- [Features](#features)
53+
- [Configuration](#configuration-1)
54+
- [Running the Service](#running-the-service)
55+
- [Project structure](#project-structure)
56+
- [Configuration classes](#configuration-classes)
57+
- [REST API](#rest-api)
4958

5059
<!-- vim-markdown-toc -->
5160

@@ -230,6 +239,78 @@ utilized:
230239
1. If the `shield_id` starts with `inout_`, it will be used both for input and output.
231240
1. Otherwise, it will be used for input only.
232241

242+
## Authentication
243+
244+
Currently supported authentication modules are:
245+
- `k8s` Kubernetes based authentication
246+
- `jwt-token` JSON Web Token based authentication
247+
- `noop` No operation authentication (default)
248+
- `noop-with-token` No operation authentication with token
249+
250+
### K8s based authentication
251+
252+
K8s based authentication is suitable for running the Lightspeed Stack in Kubernetes environments.
253+
The user accessing the service must have a valid Kubernetes token and the appropriate RBAC permissions to access the service.
254+
The user must have `get` permission on the resource path `/ls-access`.
255+
256+
Configuring K8s based authentication requires the following steps:
257+
1. Enable K8s authentication module
258+
```yaml
259+
authentication:
260+
module: "k8s"
261+
```
262+
2. Configure the Kubernetes authentication settings.
263+
When deploying Lightspeed Stack in a Kubernetes cluster, it is not required to specify cluster connection details.
264+
It automatically picks up the in-cluster configuration or through a kubeconfig file.
265+
This step is not neccessary.
266+
When running outside a kubernetes cluster or connecting to external Kubernetes clusters, Lightspeed Stack requires the cluster connection details in the configuration file:
267+
- `k8s_cluster_api` Kubernetes Cluster API URL. The URL of the K8S/OCP API server where tokens are validated.
268+
- `k8s_ca_cert_path` Path to the CA certificate file for clusters with self-signed certificates.
269+
- `skip_tls_verification` Whether to skip TLS verification.
270+
```yaml
271+
authentication:
272+
module: "k8s"
273+
skip_tls_verification: false
274+
k8s_cluster_api: "https://your-k8s-api-server:6443"
275+
k8s_ca_cert_path: "/path/to/ca.crt"
276+
```
277+
278+
### JSON Web Keyset based authentication
279+
280+
JWK (JSON Web Keyset) based authentication is suitable for scenarios where you need to authenticate users based on tokens. This method is commonly used in web applications and APIs.
281+
282+
To configure JWK based authentication, you need to specify the following settings in the configuration file:
283+
- `module` must be set to `jwk-token`
284+
- `jwk_config` JWK configuration settings must set at least `url` field:
285+
- `url`: The URL of the JWK endpoint.
286+
- `jwt_configuration`: JWT configuration settings.
287+
- `user_id_claim`: The key of the user ID in JWT claim.
288+
- `username_claim`: The key of the username in JWT claim.
289+
290+
```yaml
291+
authentication:
292+
module: "jwk-token"
293+
jwk_config:
294+
url: "https://your-jwk-url"
295+
jwt_configuration:
296+
user_id_claim: user_id
297+
username_claim: username
298+
```
299+
300+
### No-op authentication
301+
302+
Lightspeed Stack provides 2 authentication module to bypass the authentication and authorization checks:
303+
- `noop` No operation authentication (default)
304+
- `noop-with-token` No operation authentication accepting a bearer token
305+
306+
If authentication module is not specified, Lightspeed Stack will use `noop` by default.
307+
To activate `noop-with-token`, you need to specify it in the configuration file:
308+
309+
```yaml
310+
authentication:
311+
module: "noop-with-token"
312+
```
313+
233314
# Usage
234315

235316
```

0 commit comments

Comments
 (0)