Skip to content

Commit 1294e7e

Browse files
JeromeBuclaude
andcommitted
docs: add generic OIDC authentication documentation
Add comprehensive authentication guide explaining that Catalogi supports any OIDC-compliant provider via automatic discovery. - New authentication.md with generic OIDC setup guide - Environment variables (OIDC_ISSUER_URI, OIDC_CLIENT_ID, etc.) - Keycloak configuration example - Redirect URIs, scopes, troubleshooting, security - Update sidebar and README with authentication section 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent d5cb1e5 commit 1294e7e

File tree

4 files changed

+110
-3
lines changed

4 files changed

+110
-3
lines changed

docs/3.1-authentication.md

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
<!-- SPDX-FileCopyrightText: 2021-2025 DINUM <[email protected]> -->
2+
<!-- SPDX-FileCopyrightText: 2024-2025 Université Grenoble Alpes -->
3+
<!-- SPDX-License-Identifier: CC-BY-4.0 -->
4+
<!-- SPDX-License-Identifier: Etalab-2.0 -->
5+
6+
# Authentication
7+
8+
Catalogi uses OpenID Connect (OIDC) for authentication, allowing you to connect to any OIDC-compliant identity provider.
9+
10+
## How It Works
11+
12+
Catalogi implements the standard OIDC Authorization Code Flow:
13+
14+
1. User clicks login
15+
2. Application redirects to identity provider
16+
3. User authenticates with the provider
17+
4. Provider redirects back with authorization code
18+
5. Application exchanges code for tokens
19+
6. User is authenticated
20+
21+
The implementation uses automatic OIDC discovery via `/.well-known/openid-configuration`, making it compatible with any standard OIDC provider.
22+
23+
## Required Environment Variables
24+
25+
To configure authentication, you need to set the following environment variables:
26+
27+
| Variable | Description | Example |
28+
|----------|-------------|---------|
29+
| `OIDC_ISSUER_URI` | The OIDC provider's issuer URL (without `.well-known/openid-configuration`) | `https://auth.example.com/realms/my-realm` |
30+
| `OIDC_CLIENT_ID` | Your application's client ID registered with the provider | `catalogi` |
31+
| `OIDC_CLIENT_SECRET` | Your application's client secret | `secret-value-here` |
32+
| `OIDC_MANAGE_PROFILE_URL` | URL where users can manage their profile (optional) | `https://auth.example.com/realms/my-realm/account` |
33+
| `APP_URL` | Your Catalogi application URL (used for redirect URIs) | `http://localhost:3000` |
34+
35+
## Redirect URIs to Configure
36+
37+
When registering your application with the identity provider, you need to configure these redirect URIs:
38+
39+
- **Login callback**: `${APP_URL}/api/auth/callback`
40+
- **Logout callback**: `${APP_URL}/api/auth/logout/callback`
41+
42+
For example, if `APP_URL=http://localhost:3000`:
43+
- Login callback: `http://localhost:3000/api/auth/callback`
44+
- Logout callback: `http://localhost:3000/api/auth/logout/callback`
45+
46+
## Required OIDC Scopes
47+
48+
The application requests the following standard OIDC scopes:
49+
- `openid` - Required for OIDC
50+
- `email` - To get user email
51+
- `profile` - To get user profile information
52+
53+
For AgentConnect/ProConnect, additional scopes are automatically added:
54+
- `given_name`
55+
- `usual_name`
56+
57+
## Configuration Example
58+
59+
### Keycloak
60+
61+
Keycloak is an open-source identity and access management solution used as reference example.
62+
63+
```bash
64+
OIDC_ISSUER_URI=http://localhost:8080/realms/catalogi
65+
OIDC_CLIENT_ID=catalogi
66+
OIDC_CLIENT_SECRET=your-client-secret
67+
OIDC_MANAGE_PROFILE_URL=http://localhost:8080/realms/catalogi/account
68+
APP_URL=http://localhost:3000
69+
```
70+
71+
See [Setting up Keycloak](3.2-setup-a-keycloak.md) for detailed Keycloak setup instructions.
72+
73+
## Other OIDC Providers
74+
75+
Any OIDC-compliant provider should work (Keycloak, AgentConnect, ProConnect, Auth0, Okta, Google, Azure AD, etc.) as long as it:
76+
1. Provides a `/.well-known/openid-configuration` discovery endpoint
77+
2. Supports the Authorization Code flow
78+
3. Provides standard `openid`, `email`, and `profile` scopes
79+
4. Returns user information with at least `sub` and `email` claims
80+
81+
Generic configuration:
82+
```bash
83+
OIDC_ISSUER_URI=https://your-provider.com
84+
OIDC_CLIENT_ID=your-client-id
85+
OIDC_CLIENT_SECRET=your-client-secret
86+
OIDC_MANAGE_PROFILE_URL=https://your-provider.com/account
87+
APP_URL=http://localhost:3000
88+
```
89+
90+
## Security
91+
92+
**Production requirements**:
93+
- Use HTTPS for `APP_URL`
94+
- Keep `OIDC_CLIENT_SECRET` secure
95+
- Sessions use secure HTTP-only cookies (24h expiry)
96+
- Tokens stored server-side only
97+
98+
## Related Documentation
99+
100+
- [Setting up Keycloak](3.2-setup-a-keycloak.md) - Detailed Keycloak setup guide
101+
- [Environment Variables and Customization](6-env-variables-and-customization.md) - All environment variables
102+
- [Deploying with Docker Compose](4-deploying-with-docker-compose.md) - Production deployment
103+
- [Deploying with Kubernetes](5-deploying-with-kubernetes.md) - Kubernetes deployment
File renamed without changes.

docs/README.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,11 @@ Use the sidebar on the left to navigate through the complete documentation:
2424
### Getting Started
2525
- **[Getting Started](2-getting-started.md)** - Set up and run Catalogi locally for development
2626

27-
### Deployment Guides
28-
- **[Setting up Keycloak](3-setup-a-keycloak.md)** - Authentication setup with Keycloak
27+
### Authentication
28+
- **[Authentication (OIDC)](3.1-authentication.md)** - Configure authentication with any OIDC provider
29+
- **[Setting up Keycloak](3.2-setup-a-keycloak.md)** - Detailed Keycloak setup guide
30+
31+
### Deployment Guides
2932
- **[Deploying with Docker Compose](4-deploying-with-docker-compose.md)** - Production deployment using Docker Compose
3033
- **[Deploying with Kubernetes](5-deploying-with-kubernetes.md)** - Scalable deployment with Kubernetes
3134
- **[Environment Variables and Customization](6-env-variables-and-customization.md)** - Configuration options and customization

docs/_sidebar.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
<!-- SPDX-License-Identifier: Etalab-2.0 -->
55

66
* [🎯 Getting started](2-getting-started.md)
7-
<!-- * [🔐 Setting up Keycloak](3-setup-a-keycloak.md) -->
7+
* [🔐 Authentication (OIDC)](3.1-authentication.md)
8+
* [🔐 Setting up Keycloak](3.2-setup-a-keycloak.md)
89
* [🏁 Deploying the web App (docker-compose)](4-deploying-with-docker-compose.md)
910
* [🏁 Deploying the web App (Kubernetes)](5-deploying-with-kubernetes.md)
1011
* [⚙ Environment variables and customization](6-env-variables-and-customization.md)

0 commit comments

Comments
 (0)