@bluealba/platform-cli 1.0.1 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +277 -9
- package/docs/404.mdx +5 -0
- package/docs/architecture/api-explorer.mdx +478 -0
- package/docs/architecture/architecture-diagrams.mdx +12 -0
- package/docs/architecture/authentication-system.mdx +903 -0
- package/docs/architecture/authorization-system.mdx +886 -0
- package/docs/architecture/bootstrap.mdx +1442 -0
- package/docs/architecture/gateway-architecture.mdx +845 -0
- package/docs/architecture/multi-tenancy.mdx +1150 -0
- package/docs/architecture/overview.mdx +776 -0
- package/docs/architecture/scheduler.mdx +818 -0
- package/docs/architecture/shell.mdx +885 -0
- package/docs/architecture/ui-extension-points.mdx +781 -0
- package/docs/architecture/user-states.mdx +794 -0
- package/docs/development/overview.mdx +21 -0
- package/docs/development/workflow.mdx +914 -0
- package/docs/getting-started/core-concepts.mdx +892 -0
- package/docs/getting-started/installation.mdx +780 -0
- package/docs/getting-started/overview.mdx +83 -0
- package/docs/getting-started/quick-start.mdx +940 -0
- package/docs/guides/adding-documentation-sites.mdx +1367 -0
- package/docs/guides/creating-services.mdx +1736 -0
- package/docs/guides/creating-ui-modules.mdx +1860 -0
- package/docs/guides/identity-providers.mdx +1007 -0
- package/docs/guides/mermaid-diagrams.mdx +212 -0
- package/docs/guides/using-feature-flags.mdx +1059 -0
- package/docs/guides/working-with-rooms.mdx +566 -0
- package/docs/index.mdx +57 -0
- package/docs/platform-cli/commands.mdx +604 -0
- package/docs/platform-cli/overview.mdx +195 -0
- package/package.json +5 -2
- package/skills/ba-platform/platform-cli.skill.md +26 -0
- package/skills/ba-platform/platform.skill.md +35 -0
- package/templates/application-monorepo-template/gitignore +95 -0
- package/templates/bootstrap-service-template/gitignore +57 -0
- package/templates/bootstrap-service-template/src/main.ts +6 -16
- package/templates/customization-ui-module-template/gitignore +73 -0
- package/templates/nestjs-service-module-template/gitignore +56 -0
- package/templates/platform-init-template/{{platformName}}-core/gitignore +97 -0
- package/templates/react-ui-module-template/Dockerfile +1 -1
- package/templates/react-ui-module-template/caddy/Caddyfile +1 -1
- package/templates/react-ui-module-template/gitignore +72 -0
|
@@ -0,0 +1,1007 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Identity Providers Configuration
|
|
3
|
+
description: Complete guide to configuring and using Identity Providers (IDPs) with the Blue Alba Platform - Okta, Microsoft Entra ID, OneLogin, GitHub, and AWS Cognito
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
import { Card, CardGrid, Aside, Tabs, TabItem } from '@astrojs/starlight/components';
|
|
7
|
+
|
|
8
|
+
The Blue Alba Platform supports multiple Identity Providers (IDPs) for authentication, allowing you to integrate with your organization's existing identity management infrastructure. This guide covers how to configure and use each supported IDP.
|
|
9
|
+
|
|
10
|
+
## Overview
|
|
11
|
+
|
|
12
|
+
The platform uses OAuth 2.0 / OpenID Connect (OIDC) protocols to integrate with identity providers. Each provider follows the standard OAuth 2.0 Authorization Code flow with PKCE for enhanced security.
|
|
13
|
+
|
|
14
|
+
### Supported Identity Providers
|
|
15
|
+
|
|
16
|
+
<CardGrid stagger>
|
|
17
|
+
<Card title="Okta" icon="seti:config">
|
|
18
|
+
Enterprise identity and access management with comprehensive features including Universal Directory and group synchronization.
|
|
19
|
+
</Card>
|
|
20
|
+
|
|
21
|
+
<Card title="Microsoft Entra ID" icon="seti:config">
|
|
22
|
+
Azure Active Directory integration with Microsoft 365, security groups, and conditional access policies.
|
|
23
|
+
</Card>
|
|
24
|
+
|
|
25
|
+
<Card title="OneLogin" icon="seti:config">
|
|
26
|
+
SSO and unified access management with role and group mapping capabilities.
|
|
27
|
+
</Card>
|
|
28
|
+
|
|
29
|
+
<Card title="GitHub" icon="github">
|
|
30
|
+
Developer-friendly authentication with organization and team-based authorization.
|
|
31
|
+
</Card>
|
|
32
|
+
|
|
33
|
+
<Card title="AWS Cognito" icon="seti:config">
|
|
34
|
+
Amazon's managed identity service with user pools, custom attributes, and MFA support.
|
|
35
|
+
</Card>
|
|
36
|
+
</CardGrid>
|
|
37
|
+
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
## Configuration Methods
|
|
41
|
+
|
|
42
|
+
The platform supports two methods for configuring identity providers:
|
|
43
|
+
|
|
44
|
+
### 1. Database Configuration (Recommended)
|
|
45
|
+
|
|
46
|
+
Providers configured in the database are:
|
|
47
|
+
- **Editable**: Can be added, updated, or removed via Admin UI or API
|
|
48
|
+
- **Multi-tenant**: Different providers can be configured per tenant
|
|
49
|
+
- **Dynamic**: Changes take effect without restarting the service
|
|
50
|
+
- **Secure**: Credentials stored securely in the database
|
|
51
|
+
|
|
52
|
+
**To configure via Admin UI**:
|
|
53
|
+
1. Navigate to Admin UI → Authentication → Identity Providers
|
|
54
|
+
2. Click "Add Provider"
|
|
55
|
+
3. Select provider type and enter configuration details
|
|
56
|
+
4. Save and activate the provider
|
|
57
|
+
|
|
58
|
+
### 2. Environment Variables (Legacy)
|
|
59
|
+
|
|
60
|
+
Providers can also be configured via environment variables. This method is:
|
|
61
|
+
- **Read-only**: Cannot be modified via UI or API
|
|
62
|
+
- **Global**: Same provider configuration for all tenants
|
|
63
|
+
- **Static**: Requires service restart for changes
|
|
64
|
+
|
|
65
|
+
<Aside type="caution" title="Migration Notice">
|
|
66
|
+
Environment variable configuration is maintained for backward compatibility but is considered legacy. New deployments should use database configuration for better flexibility and multi-tenancy support.
|
|
67
|
+
</Aside>
|
|
68
|
+
|
|
69
|
+
---
|
|
70
|
+
|
|
71
|
+
## Provider Configuration
|
|
72
|
+
|
|
73
|
+
Each provider requires specific configuration parameters. Below are detailed setup instructions for each supported IDP.
|
|
74
|
+
|
|
75
|
+
<Tabs>
|
|
76
|
+
<TabItem label="Okta">
|
|
77
|
+
|
|
78
|
+
### Okta Configuration
|
|
79
|
+
|
|
80
|
+
Okta is an enterprise-grade identity and access management platform with comprehensive SSO capabilities.
|
|
81
|
+
|
|
82
|
+
#### Prerequisites
|
|
83
|
+
|
|
84
|
+
- Okta account (Developer or Enterprise)
|
|
85
|
+
- Admin access to create OAuth applications
|
|
86
|
+
- Okta domain (e.g., `dev-12345.okta.com`)
|
|
87
|
+
|
|
88
|
+
#### Step 1: Create OAuth Application in Okta
|
|
89
|
+
|
|
90
|
+
1. Log into your Okta Admin Console
|
|
91
|
+
2. Navigate to **Applications** → **Applications**
|
|
92
|
+
3. Click **Create App Integration**
|
|
93
|
+
4. Select **OIDC - OpenID Connect**
|
|
94
|
+
5. Choose **Web Application**
|
|
95
|
+
6. Configure the application:
|
|
96
|
+
- **App integration name**: `Blue Alba Platform`
|
|
97
|
+
- **Sign-in redirect URIs**: `https://your-platform.com/auth/okta/callback`
|
|
98
|
+
- **Sign-out redirect URIs**: `https://your-platform.com`
|
|
99
|
+
- **Controlled access**: Choose your preferred access policy
|
|
100
|
+
7. Click **Save**
|
|
101
|
+
8. Note the **Client ID** and **Client Secret**
|
|
102
|
+
|
|
103
|
+
#### Step 2: Configure Authorization Server
|
|
104
|
+
|
|
105
|
+
1. Navigate to **Security** → **API** → **Authorization Servers**
|
|
106
|
+
2. Select your authorization server (usually `default`)
|
|
107
|
+
3. Note the **Issuer URI** (e.g., `https://dev-12345.okta.com/oauth2/default`)
|
|
108
|
+
|
|
109
|
+
#### Step 3: Configure Groups (Optional)
|
|
110
|
+
|
|
111
|
+
To enable group synchronization:
|
|
112
|
+
1. Navigate to **Directory** → **Groups**
|
|
113
|
+
2. Ensure your users are assigned to appropriate groups
|
|
114
|
+
3. Okta groups will be automatically synchronized to the platform
|
|
115
|
+
|
|
116
|
+
#### Step 4: Configure Provider in Blue Alba Platform
|
|
117
|
+
|
|
118
|
+
**Via Admin UI**:
|
|
119
|
+
- **Provider Type**: Okta
|
|
120
|
+
- **Provider Name**: `okta` (or custom name)
|
|
121
|
+
- **Issuer URL**: `https://dev-12345.okta.com/oauth2/default`
|
|
122
|
+
- **Client ID**: Your Okta application client ID
|
|
123
|
+
- **Client Secret**: Your Okta application client secret
|
|
124
|
+
- **Active**: Enabled
|
|
125
|
+
|
|
126
|
+
**Via Environment Variables** (Legacy):
|
|
127
|
+
|
|
128
|
+
```bash
|
|
129
|
+
# Enable Okta provider
|
|
130
|
+
AUTH_ENV_MIGRATION_ENABLED=true
|
|
131
|
+
AUTH_OKTA_ENABLED=true
|
|
132
|
+
|
|
133
|
+
# Okta Configuration
|
|
134
|
+
AUTH_OKTA_ISSUER=https://dev-12345.okta.com/oauth2/default
|
|
135
|
+
AUTH_OKTA_CLIENT_ID=0oa1b2c3d4e5f6g7h8i9
|
|
136
|
+
AUTH_OKTA_CLIENT_SECRET=your_client_secret_here
|
|
137
|
+
|
|
138
|
+
# Optional: Custom scope
|
|
139
|
+
AUTH_OKTA_SCOPE=openid profile offline_access email
|
|
140
|
+
|
|
141
|
+
# Optional: Redirect URL override
|
|
142
|
+
AUTH_OKTA_REDIRECT_URL=https://your-platform.com/auth/okta/callback
|
|
143
|
+
|
|
144
|
+
# Optional: Custom logout URI
|
|
145
|
+
AUTH_OKTA_LOGOUT_URI=https://your-platform.com
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
#### Features
|
|
149
|
+
|
|
150
|
+
- **Single Sign-On (SSO)**: Seamless authentication via Okta
|
|
151
|
+
- **Group Synchronization**: Automatic sync of Okta groups
|
|
152
|
+
- **User Provisioning**: Automatic user creation on first login
|
|
153
|
+
- **Universal Directory**: Support for Okta's user directory
|
|
154
|
+
- **Logout Support**: Proper session termination with Okta
|
|
155
|
+
|
|
156
|
+
#### Technical Details
|
|
157
|
+
|
|
158
|
+
**OAuth Endpoints**:
|
|
159
|
+
- Authorization: `/v1/authorize`
|
|
160
|
+
- Token: `/v1/token`
|
|
161
|
+
- User Info: `/v1/userinfo`
|
|
162
|
+
|
|
163
|
+
**Scope**: `openid profile offline_access email`
|
|
164
|
+
|
|
165
|
+
**Group Sync**: Uses Okta Users API to fetch user groups
|
|
166
|
+
|
|
167
|
+
**Logout**: Supports `id_token_hint` for logout
|
|
168
|
+
|
|
169
|
+
</TabItem>
|
|
170
|
+
|
|
171
|
+
<TabItem label="Microsoft Entra ID">
|
|
172
|
+
|
|
173
|
+
### Microsoft Entra ID (Azure AD) Configuration
|
|
174
|
+
|
|
175
|
+
Microsoft Entra ID (formerly Azure Active Directory) enables authentication for Microsoft 365 users and integration with Azure services.
|
|
176
|
+
|
|
177
|
+
#### Prerequisites
|
|
178
|
+
|
|
179
|
+
- Azure subscription with Entra ID tenant
|
|
180
|
+
- Admin access to create app registrations
|
|
181
|
+
- Tenant ID and domain name
|
|
182
|
+
|
|
183
|
+
#### Step 1: Register Application in Azure Portal
|
|
184
|
+
|
|
185
|
+
1. Navigate to [Azure Portal](https://portal.azure.com)
|
|
186
|
+
2. Go to **Microsoft Entra ID** → **App registrations**
|
|
187
|
+
3. Click **New registration**
|
|
188
|
+
4. Configure the application:
|
|
189
|
+
- **Name**: `Blue Alba Platform`
|
|
190
|
+
- **Supported account types**: Choose based on your needs (usually single tenant)
|
|
191
|
+
- **Redirect URI**: Select **Web** and enter `https://your-platform.com/auth/entra-id/callback`
|
|
192
|
+
5. Click **Register**
|
|
193
|
+
6. Note the **Application (client) ID** and **Directory (tenant) ID**
|
|
194
|
+
|
|
195
|
+
#### Step 2: Create Client Secret
|
|
196
|
+
|
|
197
|
+
1. In your app registration, go to **Certificates & secrets**
|
|
198
|
+
2. Click **New client secret**
|
|
199
|
+
3. Add a description and select expiration period
|
|
200
|
+
4. Click **Add**
|
|
201
|
+
5. **Important**: Copy the secret value immediately (it won't be shown again)
|
|
202
|
+
|
|
203
|
+
#### Step 3: Configure API Permissions
|
|
204
|
+
|
|
205
|
+
1. Go to **API permissions**
|
|
206
|
+
2. Click **Add a permission** → **Microsoft Graph**
|
|
207
|
+
3. Select **Delegated permissions**
|
|
208
|
+
4. Add the following permissions:
|
|
209
|
+
- `openid`
|
|
210
|
+
- `profile`
|
|
211
|
+
- `email`
|
|
212
|
+
- `User.Read`
|
|
213
|
+
- `GroupMember.Read.All` (for group sync)
|
|
214
|
+
5. Click **Grant admin consent** (if you have admin privileges)
|
|
215
|
+
|
|
216
|
+
#### Step 4: Configure Provider in Blue Alba Platform
|
|
217
|
+
|
|
218
|
+
**Via Admin UI**:
|
|
219
|
+
- **Provider Type**: Entra ID
|
|
220
|
+
- **Provider Name**: `entra-id` (or custom name)
|
|
221
|
+
- **Issuer URL**: `https://login.microsoftonline.com/{tenant-id}`
|
|
222
|
+
- **Client ID**: Your Azure application client ID
|
|
223
|
+
- **Client Secret**: Your Azure application client secret
|
|
224
|
+
- **Active**: Enabled
|
|
225
|
+
|
|
226
|
+
**Via Environment Variables** (Legacy):
|
|
227
|
+
|
|
228
|
+
```bash
|
|
229
|
+
# Enable Entra ID provider
|
|
230
|
+
AUTH_ENV_MIGRATION_ENABLED=true
|
|
231
|
+
AUTH_ENTRAID_ENABLED=true
|
|
232
|
+
|
|
233
|
+
# Entra ID Configuration
|
|
234
|
+
AUTH_ENTRAID_ISSUER=https://login.microsoftonline.com/12345678-1234-1234-1234-123456789012
|
|
235
|
+
AUTH_ENTRAID_CLIENT_ID=87654321-4321-4321-4321-210987654321
|
|
236
|
+
AUTH_ENTRAID_CLIENT_SECRET=your_client_secret_here
|
|
237
|
+
|
|
238
|
+
# Optional: Custom token URL
|
|
239
|
+
AUTH_ENTRAID_TOKEN_URL=https://login.microsoftonline.com/12345678-1234-1234-1234-123456789012/oauth2/v2.0/token
|
|
240
|
+
|
|
241
|
+
# Optional: Custom user info URL
|
|
242
|
+
AUTH_ENTRAID_USER_INFO_URL=https://graph.microsoft.com/oidc/userinfo
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
#### Features
|
|
246
|
+
|
|
247
|
+
- **Microsoft 365 Integration**: Authenticate users from your Microsoft 365 tenant
|
|
248
|
+
- **Security Groups**: Automatic synchronization of Entra ID security groups
|
|
249
|
+
- **Conditional Access**: Support for conditional access policies
|
|
250
|
+
- **Microsoft Graph API**: Integration with Microsoft Graph for user and group data
|
|
251
|
+
- **MFA Support**: Leverages Entra ID's multi-factor authentication
|
|
252
|
+
|
|
253
|
+
#### Technical Details
|
|
254
|
+
|
|
255
|
+
**OAuth Endpoints**:
|
|
256
|
+
- Authorization: `/oauth2/v2.0/authorize`
|
|
257
|
+
- Token: `/oauth2/v2.0/token`
|
|
258
|
+
- User Info: `https://graph.microsoft.com/oidc/userinfo` (absolute URL)
|
|
259
|
+
|
|
260
|
+
**Scope**: `openid profile email`
|
|
261
|
+
|
|
262
|
+
**Group Sync**: Uses Microsoft Graph API to fetch user groups
|
|
263
|
+
|
|
264
|
+
**API Integration**: Requires Microsoft Graph API permissions
|
|
265
|
+
|
|
266
|
+
</TabItem>
|
|
267
|
+
|
|
268
|
+
<TabItem label="OneLogin">
|
|
269
|
+
|
|
270
|
+
### OneLogin Configuration
|
|
271
|
+
|
|
272
|
+
OneLogin provides enterprise SSO and unified access management with comprehensive role and group mapping.
|
|
273
|
+
|
|
274
|
+
#### Prerequisites
|
|
275
|
+
|
|
276
|
+
- OneLogin account (Developer or Enterprise)
|
|
277
|
+
- Admin access to create OAuth applications
|
|
278
|
+
- OneLogin subdomain (e.g., `acme.onelogin.com`)
|
|
279
|
+
|
|
280
|
+
#### Step 1: Create OAuth Application in OneLogin
|
|
281
|
+
|
|
282
|
+
1. Log into your OneLogin Admin Portal
|
|
283
|
+
2. Navigate to **Applications** → **Applications**
|
|
284
|
+
3. Click **Add App**
|
|
285
|
+
4. Search for **OpenId Connect (OIDC)** and select it
|
|
286
|
+
5. Configure the application:
|
|
287
|
+
- **Display Name**: `Blue Alba Platform`
|
|
288
|
+
- **Redirect URIs**: `https://your-platform.com/auth/onelogin/callback`
|
|
289
|
+
- **Login URL**: `https://your-platform.com`
|
|
290
|
+
6. Click **Save**
|
|
291
|
+
7. Go to the **SSO** tab
|
|
292
|
+
8. Note the **Client ID** and **Client Secret**
|
|
293
|
+
|
|
294
|
+
#### Step 2: Configure Token Settings
|
|
295
|
+
|
|
296
|
+
1. In the **SSO** tab, configure:
|
|
297
|
+
- **Application Type**: Web
|
|
298
|
+
- **Token Endpoint**: Authentication Methods should include **POST**
|
|
299
|
+
- **Token Timeout**: Set according to your security requirements
|
|
300
|
+
2. Save the configuration
|
|
301
|
+
|
|
302
|
+
#### Step 3: Assign Users
|
|
303
|
+
|
|
304
|
+
1. Go to the **Users** tab
|
|
305
|
+
2. Assign users or rules for user assignment
|
|
306
|
+
3. Users will now be able to authenticate via OneLogin
|
|
307
|
+
|
|
308
|
+
#### Step 4: Configure Provider in Blue Alba Platform
|
|
309
|
+
|
|
310
|
+
**Via Admin UI**:
|
|
311
|
+
- **Provider Type**: OneLogin
|
|
312
|
+
- **Provider Name**: `onelogin` (or custom name)
|
|
313
|
+
- **Issuer URL**: `https://acme.onelogin.com/oidc/2`
|
|
314
|
+
- **Client ID**: Your OneLogin application client ID
|
|
315
|
+
- **Client Secret**: Your OneLogin application client secret
|
|
316
|
+
- **Extras**: Add `{ "region": "us" }` or `{ "region": "eu" }` based on your OneLogin region
|
|
317
|
+
- **Active**: Enabled
|
|
318
|
+
|
|
319
|
+
**Via Environment Variables** (Legacy):
|
|
320
|
+
|
|
321
|
+
```bash
|
|
322
|
+
# Enable OneLogin provider
|
|
323
|
+
AUTH_ENV_MIGRATION_ENABLED=true
|
|
324
|
+
AUTH_ONELOGIN_ENABLED=true
|
|
325
|
+
|
|
326
|
+
# OneLogin Configuration
|
|
327
|
+
AUTH_ONELOGIN_ISSUER=https://acme.onelogin.com/oidc/2
|
|
328
|
+
AUTH_ONELOGIN_CLIENT_ID=abc123def456
|
|
329
|
+
AUTH_ONELOGIN_CLIENT_SECRET=your_client_secret_here
|
|
330
|
+
|
|
331
|
+
# OneLogin Region (us or eu)
|
|
332
|
+
AUTH_ONELOGIN_REGION=us
|
|
333
|
+
|
|
334
|
+
# Optional: Subdomain (alternative to full issuer URL)
|
|
335
|
+
AUTH_ONELOGIN_SUBDOMAIN=acme
|
|
336
|
+
```
|
|
337
|
+
|
|
338
|
+
#### Features
|
|
339
|
+
|
|
340
|
+
- **SSO Integration**: Seamless single sign-on
|
|
341
|
+
- **Role Mapping**: Map OneLogin roles to platform roles
|
|
342
|
+
- **Group Management**: Automatic group synchronization
|
|
343
|
+
- **API Access**: Integration with OneLogin API for user management
|
|
344
|
+
- **Multi-region Support**: Support for US and EU regions
|
|
345
|
+
- **Logout Support**: Proper session termination
|
|
346
|
+
|
|
347
|
+
#### Technical Details
|
|
348
|
+
|
|
349
|
+
**OAuth Endpoints**:
|
|
350
|
+
- Authorization: `/oidc/2/auth`
|
|
351
|
+
- Token: `/oidc/2/token`
|
|
352
|
+
- User Info: `/oidc/2/me`
|
|
353
|
+
|
|
354
|
+
**Scope**: `openid profile email`
|
|
355
|
+
|
|
356
|
+
**Group Sync**: Uses OneLogin API to fetch user groups
|
|
357
|
+
|
|
358
|
+
**Logout**: Supports `id_token_hint` for logout
|
|
359
|
+
|
|
360
|
+
**Region Specific**: API and OAuth URLs vary by region (US/EU)
|
|
361
|
+
|
|
362
|
+
</TabItem>
|
|
363
|
+
|
|
364
|
+
<TabItem label="GitHub">
|
|
365
|
+
|
|
366
|
+
### GitHub OAuth Configuration
|
|
367
|
+
|
|
368
|
+
GitHub OAuth enables authentication for developers and teams, with support for organization and team-based authorization.
|
|
369
|
+
|
|
370
|
+
#### Prerequisites
|
|
371
|
+
|
|
372
|
+
- GitHub account
|
|
373
|
+
- Access to create OAuth apps in your organization (or personal account)
|
|
374
|
+
- Organization membership (for organization-based access control)
|
|
375
|
+
|
|
376
|
+
#### Step 1: Create OAuth App in GitHub
|
|
377
|
+
|
|
378
|
+
1. Navigate to GitHub Settings:
|
|
379
|
+
- **For Organization**: Go to your organization → Settings → Developer settings → OAuth Apps
|
|
380
|
+
- **For Personal**: Go to your profile → Settings → Developer settings → OAuth Apps
|
|
381
|
+
2. Click **New OAuth App**
|
|
382
|
+
3. Configure the application:
|
|
383
|
+
- **Application name**: `Blue Alba Platform`
|
|
384
|
+
- **Homepage URL**: `https://your-platform.com`
|
|
385
|
+
- **Authorization callback URL**: `https://your-platform.com/auth/github/callback`
|
|
386
|
+
- **Application description**: (Optional) Description of your platform
|
|
387
|
+
4. Click **Register application**
|
|
388
|
+
5. Note the **Client ID**
|
|
389
|
+
6. Click **Generate a new client secret**
|
|
390
|
+
7. Note the **Client Secret** (it won't be shown again)
|
|
391
|
+
|
|
392
|
+
#### Step 2: Configure Provider in Blue Alba Platform
|
|
393
|
+
|
|
394
|
+
**Via Admin UI**:
|
|
395
|
+
- **Provider Type**: GitHub
|
|
396
|
+
- **Provider Name**: `github` (or custom name)
|
|
397
|
+
- **Issuer URL**: `https://github.com`
|
|
398
|
+
- **Client ID**: Your GitHub OAuth app client ID
|
|
399
|
+
- **Client Secret**: Your GitHub OAuth app client secret
|
|
400
|
+
- **Active**: Enabled
|
|
401
|
+
|
|
402
|
+
**Via Environment Variables** (Legacy):
|
|
403
|
+
|
|
404
|
+
```bash
|
|
405
|
+
# Enable GitHub provider
|
|
406
|
+
AUTH_ENV_MIGRATION_ENABLED=true
|
|
407
|
+
AUTH_GITHUB_ENABLED=true
|
|
408
|
+
|
|
409
|
+
# GitHub Configuration
|
|
410
|
+
AUTH_GITHUB_ISSUER=https://github.com
|
|
411
|
+
AUTH_GITHUB_CLIENT_ID=Iv1.a1b2c3d4e5f6g7h8
|
|
412
|
+
AUTH_GITHUB_CLIENT_SECRET=your_client_secret_here
|
|
413
|
+
|
|
414
|
+
# Optional: Redirect URL override
|
|
415
|
+
AUTH_GITHUB_REDIRECT_URL=https://your-platform.com/auth/github/callback
|
|
416
|
+
```
|
|
417
|
+
|
|
418
|
+
#### Features
|
|
419
|
+
|
|
420
|
+
- **GitHub Authentication**: Authenticate users via GitHub accounts
|
|
421
|
+
- **Organization Membership**: Verify organization membership
|
|
422
|
+
- **Team-based Authorization**: Map GitHub teams to platform groups
|
|
423
|
+
- **Public Profile Access**: Access to user's public GitHub profile
|
|
424
|
+
- **Email Verification**: Access to user's verified email addresses
|
|
425
|
+
- **Developer Friendly**: Ideal for developer-focused applications
|
|
426
|
+
|
|
427
|
+
#### Technical Details
|
|
428
|
+
|
|
429
|
+
**OAuth Endpoints**:
|
|
430
|
+
- Authorization: `/login/oauth/authorize`
|
|
431
|
+
- Token: `/login/oauth/access_token`
|
|
432
|
+
- User Info: `https://api.github.com/user` (absolute URL)
|
|
433
|
+
|
|
434
|
+
**Scope**: `user:email offline_access`
|
|
435
|
+
|
|
436
|
+
**No Built-in Group Sync**: Groups must be managed separately or mapped from organizations/teams
|
|
437
|
+
|
|
438
|
+
**API Access**: Integrates with GitHub REST API
|
|
439
|
+
|
|
440
|
+
#### Limitations
|
|
441
|
+
|
|
442
|
+
**No Enterprise Features**: Basic OAuth doesn't include advanced enterprise features
|
|
443
|
+
|
|
444
|
+
**Rate Limiting**: Subject to GitHub API rate limits
|
|
445
|
+
|
|
446
|
+
**Organization Access**: Requires organization membership for team-based features
|
|
447
|
+
|
|
448
|
+
</TabItem>
|
|
449
|
+
|
|
450
|
+
<TabItem label="AWS Cognito">
|
|
451
|
+
|
|
452
|
+
### AWS Cognito Configuration
|
|
453
|
+
|
|
454
|
+
AWS Cognito is Amazon's managed identity service providing user pools with MFA, custom attributes, and Lambda trigger support.
|
|
455
|
+
|
|
456
|
+
#### Prerequisites
|
|
457
|
+
|
|
458
|
+
- AWS account with Cognito access
|
|
459
|
+
- IAM permissions to create and configure user pools
|
|
460
|
+
- Cognito User Pool created
|
|
461
|
+
|
|
462
|
+
#### Step 1: Create User Pool
|
|
463
|
+
|
|
464
|
+
1. Navigate to [AWS Cognito Console](https://console.aws.amazon.com/cognito)
|
|
465
|
+
2. Click **Create user pool**
|
|
466
|
+
3. Configure sign-in options:
|
|
467
|
+
- Select **Email** as sign-in option
|
|
468
|
+
- Choose password requirements
|
|
469
|
+
4. Configure security requirements:
|
|
470
|
+
- Set password policy
|
|
471
|
+
- Enable MFA if desired
|
|
472
|
+
5. Configure sign-up experience:
|
|
473
|
+
- Choose required attributes (email, name, etc.)
|
|
474
|
+
- Add custom attributes if needed
|
|
475
|
+
6. Configure message delivery:
|
|
476
|
+
- Set up email provider (SES or Cognito default)
|
|
477
|
+
7. Integrate your app:
|
|
478
|
+
- **User pool name**: `blue-alba-platform-users`
|
|
479
|
+
- **App type**: Web application
|
|
480
|
+
- **App client name**: `blue-alba-platform-client`
|
|
481
|
+
- **Client secret**: Generate a client secret
|
|
482
|
+
- **Callback URLs**: `https://your-platform.com/auth/cognito/callback`
|
|
483
|
+
- **Sign out URLs**: `https://your-platform.com`
|
|
484
|
+
8. Review and create
|
|
485
|
+
|
|
486
|
+
#### Step 2: Configure Hosted UI Domain
|
|
487
|
+
|
|
488
|
+
1. In your User Pool, go to **App integration** → **Domain**
|
|
489
|
+
2. Choose **Cognito domain** or **Custom domain**
|
|
490
|
+
3. Enter a domain prefix (e.g., `acme-auth`)
|
|
491
|
+
4. Save changes
|
|
492
|
+
5. Note the full domain: `https://acme-auth.auth.us-east-1.amazoncognito.com`
|
|
493
|
+
|
|
494
|
+
#### Step 3: Note Configuration Details
|
|
495
|
+
|
|
496
|
+
From your User Pool, gather:
|
|
497
|
+
- **User Pool ID**: Found in pool details (e.g., `us-east-1_ABC123DEF`)
|
|
498
|
+
- **App Client ID**: From App integration → App clients
|
|
499
|
+
- **App Client Secret**: From App integration → App clients
|
|
500
|
+
- **Domain**: Your Cognito domain from previous step
|
|
501
|
+
- **Region**: Your AWS region (e.g., `us-east-1`)
|
|
502
|
+
|
|
503
|
+
#### Step 4: Configure Provider in Blue Alba Platform
|
|
504
|
+
|
|
505
|
+
**Via Admin UI**:
|
|
506
|
+
- **Provider Type**: Cognito
|
|
507
|
+
- **Provider Name**: `cognito` (or custom name)
|
|
508
|
+
- **Issuer URL**: `https://cognito-idp.us-east-1.amazonaws.com/us-east-1_ABC123DEF`
|
|
509
|
+
- **Client ID**: Your Cognito app client ID
|
|
510
|
+
- **Client Secret**: Your Cognito app client secret
|
|
511
|
+
- **Extras**: Add `{ "region": "us-east-1", "userPoolId": "us-east-1_ABC123DEF", "domain": "acme-auth.auth.us-east-1.amazoncognito.com" }`
|
|
512
|
+
- **Active**: Enabled
|
|
513
|
+
|
|
514
|
+
**Via Environment Variables** (Legacy):
|
|
515
|
+
|
|
516
|
+
```bash
|
|
517
|
+
# Enable Cognito provider
|
|
518
|
+
AUTH_ENV_MIGRATION_ENABLED=true
|
|
519
|
+
AUTH_COGNITO_ENABLED=true
|
|
520
|
+
|
|
521
|
+
# Cognito Configuration
|
|
522
|
+
AUTH_COGNITO_USER_POOL_ID=us-east-1_ABC123DEF
|
|
523
|
+
AUTH_COGNITO_CLIENT_ID=1a2b3c4d5e6f7g8h9i0j1k2l3m
|
|
524
|
+
AUTH_COGNITO_CLIENT_SECRET=your_client_secret_here
|
|
525
|
+
AUTH_COGNITO_DOMAIN=acme-auth.auth.us-east-1.amazoncognito.com
|
|
526
|
+
AUTH_COGNITO_REGION=us-east-1
|
|
527
|
+
|
|
528
|
+
# Optional: Redirect URL override
|
|
529
|
+
AUTH_COGNITO_REDIRECT_URL=https://your-platform.com/auth/cognito/callback
|
|
530
|
+
```
|
|
531
|
+
|
|
532
|
+
#### Features
|
|
533
|
+
|
|
534
|
+
- **Managed User Pools**: AWS-managed user directory
|
|
535
|
+
- **Custom Attributes**: Add custom user attributes
|
|
536
|
+
- **MFA Integration**: Built-in multi-factor authentication
|
|
537
|
+
- **Lambda Triggers**: Customize authentication flow with Lambda functions
|
|
538
|
+
- **Social Identity Providers**: Can federate with Facebook, Google, Amazon, Apple
|
|
539
|
+
- **SAML Federation**: Support for enterprise SAML providers
|
|
540
|
+
- **Advanced Security**: Compromised credential detection, risk-based authentication
|
|
541
|
+
- **Group Management**: Cognito groups synchronized to platform
|
|
542
|
+
|
|
543
|
+
#### Technical Details
|
|
544
|
+
|
|
545
|
+
**OAuth Endpoints**:
|
|
546
|
+
- Authorization: `/oauth2/authorize`
|
|
547
|
+
- Token: `/oauth2/token`
|
|
548
|
+
- User Info: `/oauth2/userInfo`
|
|
549
|
+
|
|
550
|
+
**Scope**: `openid profile email`
|
|
551
|
+
|
|
552
|
+
**Group Sync**: Uses Cognito Admin API to fetch user groups
|
|
553
|
+
|
|
554
|
+
**Logout**: Custom logout flow with `client_id` and `logout_uri`
|
|
555
|
+
|
|
556
|
+
**Issuer Format**: `https://cognito-idp.{region}.amazonaws.com/{userPoolId}`
|
|
557
|
+
|
|
558
|
+
#### AWS-Specific Considerations
|
|
559
|
+
|
|
560
|
+
**Cost**: Pay per monthly active user (free tier available)
|
|
561
|
+
|
|
562
|
+
**Regional**: User pools are region-specific
|
|
563
|
+
|
|
564
|
+
**IAM Credentials**: May need AWS credentials for advanced API access
|
|
565
|
+
|
|
566
|
+
**Lambda Customization**: Can customize flows with Lambda triggers
|
|
567
|
+
|
|
568
|
+
</TabItem>
|
|
569
|
+
</Tabs>
|
|
570
|
+
|
|
571
|
+
---
|
|
572
|
+
|
|
573
|
+
## Common Configuration Parameters
|
|
574
|
+
|
|
575
|
+
All identity providers share common configuration parameters:
|
|
576
|
+
|
|
577
|
+
| Parameter | Required | Description |
|
|
578
|
+
|-----------|----------|-------------|
|
|
579
|
+
| **Provider Type** | Yes | The type of IDP (okta, entra-id, onelogin, github, cognito) |
|
|
580
|
+
| **Provider Name** | Yes | Unique name for the provider (used in login URLs) |
|
|
581
|
+
| **Issuer URL** | Yes | The OAuth issuer URL (IDP base URL) |
|
|
582
|
+
| **Client ID** | Yes | OAuth client/application ID from IDP |
|
|
583
|
+
| **Client Secret** | Yes | OAuth client secret from IDP |
|
|
584
|
+
| **Active** | Yes | Whether the provider is enabled |
|
|
585
|
+
| **Scope** | No | OAuth scopes (defaults set per provider) |
|
|
586
|
+
| **Redirect URL** | No | Override default callback URL |
|
|
587
|
+
| **Logout URI** | No | Custom logout redirect URL |
|
|
588
|
+
| **Extras** | No | Provider-specific additional configuration (JSON) |
|
|
589
|
+
|
|
590
|
+
---
|
|
591
|
+
|
|
592
|
+
## Authentication Flow
|
|
593
|
+
|
|
594
|
+
All providers follow the standard OAuth 2.0 Authorization Code flow:
|
|
595
|
+
|
|
596
|
+
```mermaid
|
|
597
|
+
sequenceDiagram
|
|
598
|
+
participant User
|
|
599
|
+
participant Browser
|
|
600
|
+
participant Gateway
|
|
601
|
+
participant IDP
|
|
602
|
+
participant Platform
|
|
603
|
+
|
|
604
|
+
User->>Browser: Click "Login with [Provider]"
|
|
605
|
+
Browser->>Gateway: GET /auth/login?provider=okta
|
|
606
|
+
Gateway->>Gateway: Generate PKCE challenge & state
|
|
607
|
+
Gateway->>Browser: Redirect to IDP
|
|
608
|
+
Browser->>IDP: GET /authorize?client_id=...&redirect_uri=...
|
|
609
|
+
IDP->>User: Show login page
|
|
610
|
+
User->>IDP: Enter credentials
|
|
611
|
+
IDP->>IDP: Authenticate user
|
|
612
|
+
IDP->>Browser: Redirect with authorization code
|
|
613
|
+
Browser->>Gateway: GET /auth/callback?code=xyz&state=abc
|
|
614
|
+
Gateway->>IDP: POST /token (exchange code for tokens)
|
|
615
|
+
IDP->>Gateway: Access token + ID token
|
|
616
|
+
Gateway->>IDP: GET /userinfo (with access token)
|
|
617
|
+
IDP->>Gateway: User info (email, name, etc.)
|
|
618
|
+
Gateway->>Platform: Create/update user
|
|
619
|
+
Gateway->>Platform: Sync groups
|
|
620
|
+
Gateway->>Gateway: Generate platform JWT
|
|
621
|
+
Gateway->>Browser: Set auth cookie + redirect to app
|
|
622
|
+
Browser->>User: Logged in successfully
|
|
623
|
+
```
|
|
624
|
+
|
|
625
|
+
---
|
|
626
|
+
|
|
627
|
+
## User Provisioning
|
|
628
|
+
|
|
629
|
+
When a user authenticates for the first time, the platform automatically:
|
|
630
|
+
|
|
631
|
+
1. **Creates User Record**: A new user account is created in the platform database
|
|
632
|
+
2. **Maps User Info**: User information from IDP is mapped to platform user fields:
|
|
633
|
+
- Username/Email
|
|
634
|
+
- Display Name
|
|
635
|
+
- First Name / Last Name
|
|
636
|
+
- IDP user ID (for linking)
|
|
637
|
+
3. **Syncs Groups**: User's groups from IDP are synchronized to the platform
|
|
638
|
+
4. **Assigns Roles**: Groups are used to determine user roles and permissions
|
|
639
|
+
5. **Generates JWT**: A platform JWT token is created with user identity and permissions
|
|
640
|
+
|
|
641
|
+
### User Info Mapping
|
|
642
|
+
|
|
643
|
+
Each provider has a custom mapper that translates IDP user info to platform format:
|
|
644
|
+
|
|
645
|
+
```typescript
|
|
646
|
+
// Example: Okta user info mapping
|
|
647
|
+
{
|
|
648
|
+
// IDP provides:
|
|
649
|
+
sub: "00u1a2b3c4d5e6f7g8h",
|
|
650
|
+
email: "john.doe@acme.com",
|
|
651
|
+
name: "John Doe",
|
|
652
|
+
given_name: "John",
|
|
653
|
+
family_name: "Doe",
|
|
654
|
+
|
|
655
|
+
// Platform maps to:
|
|
656
|
+
username: "john.doe@acme.com",
|
|
657
|
+
displayName: "John Doe",
|
|
658
|
+
firstName: "John",
|
|
659
|
+
lastName: "Doe",
|
|
660
|
+
authProviderUserId: "00u1a2b3c4d5e6f7g8h",
|
|
661
|
+
authProviderName: "okta"
|
|
662
|
+
}
|
|
663
|
+
```
|
|
664
|
+
|
|
665
|
+
---
|
|
666
|
+
|
|
667
|
+
## Group Synchronization
|
|
668
|
+
|
|
669
|
+
Most providers support automatic group synchronization, which maps IDP groups to platform groups:
|
|
670
|
+
|
|
671
|
+
### Providers with Group Sync
|
|
672
|
+
|
|
673
|
+
| Provider | Group Sync | API Used | Notes |
|
|
674
|
+
|----------|------------|----------|-------|
|
|
675
|
+
| **Okta** | Yes | Okta Users API | Fetches all groups user is a member of |
|
|
676
|
+
| **Entra ID** | Yes | Microsoft Graph API | Requires `GroupMember.Read.All` permission |
|
|
677
|
+
| **OneLogin** | Yes | OneLogin API | Fetches roles and groups |
|
|
678
|
+
| **Cognito** | Yes | Cognito Admin API | Fetches Cognito user pool groups |
|
|
679
|
+
| **GitHub** | No | N/A | Groups must be managed in platform |
|
|
680
|
+
|
|
681
|
+
### Group Sync Process
|
|
682
|
+
|
|
683
|
+
1. User authenticates with IDP
|
|
684
|
+
2. Platform retrieves access token
|
|
685
|
+
3. Platform calls IDP's group API with access token
|
|
686
|
+
4. IDP returns list of groups user belongs to
|
|
687
|
+
5. Platform creates/updates corresponding groups in database
|
|
688
|
+
6. User is assigned to these groups in platform
|
|
689
|
+
7. Groups determine user's roles and permissions
|
|
690
|
+
|
|
691
|
+
### Configuring Group Sync
|
|
692
|
+
|
|
693
|
+
**For Entra ID**:
|
|
694
|
+
- Ensure app has `GroupMember.Read.All` permission
|
|
695
|
+
- Grant admin consent for the permission
|
|
696
|
+
- Groups will be automatically synced on login
|
|
697
|
+
|
|
698
|
+
**For Okta**:
|
|
699
|
+
- No additional configuration needed
|
|
700
|
+
- All Okta groups are automatically synced
|
|
701
|
+
|
|
702
|
+
**For OneLogin**:
|
|
703
|
+
- Ensure API credentials have group read access
|
|
704
|
+
- Groups and roles are synced
|
|
705
|
+
|
|
706
|
+
**For Cognito**:
|
|
707
|
+
- Ensure user is member of Cognito groups
|
|
708
|
+
- Groups must be created in Cognito User Pool first
|
|
709
|
+
- IAM credentials may be needed for Admin API access
|
|
710
|
+
|
|
711
|
+
---
|
|
712
|
+
|
|
713
|
+
## Multi-Tenant Configuration
|
|
714
|
+
|
|
715
|
+
The platform supports multiple identity providers per tenant, enabling:
|
|
716
|
+
|
|
717
|
+
- **Different IDPs per Tenant**: Each tenant can use a different IDP
|
|
718
|
+
- **Multiple IDPs per Tenant**: A single tenant can support multiple IDPs
|
|
719
|
+
- **Provider Isolation**: IDP configurations are isolated per tenant
|
|
720
|
+
|
|
721
|
+
### Configuration
|
|
722
|
+
|
|
723
|
+
When configuring a provider in the database, you can associate it with specific tenants:
|
|
724
|
+
|
|
725
|
+
1. Create provider configuration
|
|
726
|
+
2. Link provider to tenant(s) via `oauth_provider_tenants` table
|
|
727
|
+
3. Users from each tenant authenticate via their configured IDP
|
|
728
|
+
|
|
729
|
+
### Login Flow with Multi-Tenancy
|
|
730
|
+
|
|
731
|
+
```
|
|
732
|
+
1. User goes to: https://your-platform.com
|
|
733
|
+
2. Platform detects tenant (from subdomain or user input)
|
|
734
|
+
3. Platform shows available IDPs for that tenant
|
|
735
|
+
4. User selects IDP
|
|
736
|
+
5. Authentication proceeds via selected IDP
|
|
737
|
+
```
|
|
738
|
+
|
|
739
|
+
---
|
|
740
|
+
|
|
741
|
+
## Testing Your Configuration
|
|
742
|
+
|
|
743
|
+
After configuring an identity provider, test the integration:
|
|
744
|
+
|
|
745
|
+
### 1. Basic Authentication Test
|
|
746
|
+
|
|
747
|
+
```bash
|
|
748
|
+
# Navigate to login URL
|
|
749
|
+
https://your-platform.com/auth/login?provider=okta
|
|
750
|
+
|
|
751
|
+
# You should be redirected to IDP login page
|
|
752
|
+
# After authentication, you should be redirected back with JWT cookie
|
|
753
|
+
```
|
|
754
|
+
|
|
755
|
+
### 2. Verify User Creation
|
|
756
|
+
|
|
757
|
+
1. Authenticate a test user
|
|
758
|
+
2. Check Admin UI → Users
|
|
759
|
+
3. Verify user record was created with correct details
|
|
760
|
+
|
|
761
|
+
### 3. Verify Group Sync
|
|
762
|
+
|
|
763
|
+
1. Ensure test user has groups in IDP
|
|
764
|
+
2. Authenticate the user
|
|
765
|
+
3. Check user's groups in Admin UI → Users → [User] → Groups
|
|
766
|
+
4. Verify groups match IDP groups
|
|
767
|
+
|
|
768
|
+
### 4. Test Logout
|
|
769
|
+
|
|
770
|
+
```bash
|
|
771
|
+
# Navigate to logout URL
|
|
772
|
+
https://your-platform.com/auth/logout
|
|
773
|
+
|
|
774
|
+
# Verify you're logged out from both platform and IDP
|
|
775
|
+
```
|
|
776
|
+
|
|
777
|
+
### 5. Check Logs
|
|
778
|
+
|
|
779
|
+
Monitor gateway service logs for authentication events:
|
|
780
|
+
|
|
781
|
+
```bash
|
|
782
|
+
# Look for successful authentication logs
|
|
783
|
+
[AuthenticationService] User authenticated: john.doe@acme.com
|
|
784
|
+
[GroupsService] Synced 3 groups for user: john.doe@acme.com
|
|
785
|
+
[UsersService] Created new user: john.doe@acme.com
|
|
786
|
+
```
|
|
787
|
+
|
|
788
|
+
---
|
|
789
|
+
|
|
790
|
+
## Troubleshooting
|
|
791
|
+
|
|
792
|
+
### Common Issues and Solutions
|
|
793
|
+
|
|
794
|
+
<Aside type="tip" title="Enable Debug Logging">
|
|
795
|
+
Set `LOG_LEVEL=debug` in gateway service environment to see detailed OAuth flow logs.
|
|
796
|
+
</Aside>
|
|
797
|
+
|
|
798
|
+
#### "Invalid redirect_uri"
|
|
799
|
+
|
|
800
|
+
**Cause**: The redirect URI in your platform doesn't match the one configured in IDP.
|
|
801
|
+
|
|
802
|
+
**Solution**:
|
|
803
|
+
- Verify redirect URI in IDP matches: `https://your-platform.com/auth/{provider}/callback`
|
|
804
|
+
- Ensure protocol (http vs https) matches
|
|
805
|
+
- Check for trailing slashes
|
|
806
|
+
|
|
807
|
+
#### "Invalid client_id or client_secret"
|
|
808
|
+
|
|
809
|
+
**Cause**: Incorrect credentials entered in platform configuration.
|
|
810
|
+
|
|
811
|
+
**Solution**:
|
|
812
|
+
- Double-check client ID and secret from IDP
|
|
813
|
+
- Ensure no extra spaces or characters
|
|
814
|
+
- Regenerate secret if needed
|
|
815
|
+
|
|
816
|
+
#### "User info not found" or "Email not provided"
|
|
817
|
+
|
|
818
|
+
**Cause**: IDP not configured to return required user attributes.
|
|
819
|
+
|
|
820
|
+
**Solution**:
|
|
821
|
+
- Verify OAuth scopes include `profile` and `email`
|
|
822
|
+
- Check IDP app configuration allows access to user info
|
|
823
|
+
- For Entra ID, ensure API permissions are granted
|
|
824
|
+
|
|
825
|
+
#### Groups Not Syncing
|
|
826
|
+
|
|
827
|
+
**Cause**: Missing API permissions or group access.
|
|
828
|
+
|
|
829
|
+
**Solution**:
|
|
830
|
+
- **Entra ID**: Grant `GroupMember.Read.All` permission and admin consent
|
|
831
|
+
- **Okta**: Verify API token has group read access
|
|
832
|
+
- **OneLogin**: Check API credentials have group permissions
|
|
833
|
+
- **Cognito**: Ensure IAM credentials for Admin API
|
|
834
|
+
|
|
835
|
+
#### "State mismatch" or CSRF errors
|
|
836
|
+
|
|
837
|
+
**Cause**: State parameter doesn't match between authorization and callback.
|
|
838
|
+
|
|
839
|
+
**Solution**:
|
|
840
|
+
- This usually indicates session storage issues
|
|
841
|
+
- Check Redis or session store is working correctly
|
|
842
|
+
- Verify state parameter is being stored and retrieved
|
|
843
|
+
|
|
844
|
+
#### Token Expired Errors
|
|
845
|
+
|
|
846
|
+
**Cause**: IDP access token has expired.
|
|
847
|
+
|
|
848
|
+
**Solution**:
|
|
849
|
+
- Ensure `offline_access` scope is included (for refresh tokens)
|
|
850
|
+
- Configure token refresh logic
|
|
851
|
+
- Check IDP token lifetime settings
|
|
852
|
+
|
|
853
|
+
#### CORS Errors
|
|
854
|
+
|
|
855
|
+
**Cause**: Browser blocking requests due to CORS policy.
|
|
856
|
+
|
|
857
|
+
**Solution**:
|
|
858
|
+
- Not typical for OAuth flows (server-side redirects)
|
|
859
|
+
- If using SPA authentication, configure CORS properly
|
|
860
|
+
- Ensure using standard OAuth flow, not implicit flow
|
|
861
|
+
|
|
862
|
+
---
|
|
863
|
+
|
|
864
|
+
## Security Best Practices
|
|
865
|
+
|
|
866
|
+
<Aside type="caution" title="Security Recommendations">
|
|
867
|
+
|
|
868
|
+
**Credential Security**:
|
|
869
|
+
- Store client secrets securely (use database encryption or secrets manager)
|
|
870
|
+
- Rotate client secrets regularly (e.g., every 90 days)
|
|
871
|
+
- Use environment variables only for non-production environments
|
|
872
|
+
- Never commit secrets to version control
|
|
873
|
+
|
|
874
|
+
**OAuth Security**:
|
|
875
|
+
- Always use HTTPS in production (required for OAuth)
|
|
876
|
+
- Implement PKCE (Proof Key for Code Exchange) - platform does this automatically
|
|
877
|
+
- Validate state parameter to prevent CSRF attacks
|
|
878
|
+
- Use short-lived authorization codes
|
|
879
|
+
- Implement token rotation for refresh tokens
|
|
880
|
+
|
|
881
|
+
**Application Security**:
|
|
882
|
+
- Limit OAuth scopes to minimum required
|
|
883
|
+
- Implement proper session timeout
|
|
884
|
+
- Monitor for unusual authentication patterns
|
|
885
|
+
- Enable MFA in IDP when possible
|
|
886
|
+
- Use secure, HTTP-only cookies for session tokens
|
|
887
|
+
|
|
888
|
+
**Access Control**:
|
|
889
|
+
- Implement principle of least privilege
|
|
890
|
+
- Regularly review group and role assignments
|
|
891
|
+
- Audit authentication and authorization events
|
|
892
|
+
- Monitor for unauthorized access attempts
|
|
893
|
+
|
|
894
|
+
**Compliance**:
|
|
895
|
+
- Ensure IDP configuration meets regulatory requirements
|
|
896
|
+
- Implement audit logging for authentication events
|
|
897
|
+
- Review and comply with data residency requirements
|
|
898
|
+
- Document authentication flows for compliance audits
|
|
899
|
+
|
|
900
|
+
</Aside>
|
|
901
|
+
|
|
902
|
+
---
|
|
903
|
+
|
|
904
|
+
## Advanced Configuration
|
|
905
|
+
|
|
906
|
+
### Custom Provider (Generic OIDC)
|
|
907
|
+
|
|
908
|
+
The platform also supports generic OpenID Connect providers that aren't pre-configured:
|
|
909
|
+
|
|
910
|
+
```javascript
|
|
911
|
+
// Via Admin UI, select "Custom" provider type
|
|
912
|
+
{
|
|
913
|
+
"type": "custom",
|
|
914
|
+
"name": "my-custom-idp",
|
|
915
|
+
"issuer": "https://idp.example.com",
|
|
916
|
+
"clientId": "your-client-id",
|
|
917
|
+
"clientSecret": "your-client-secret",
|
|
918
|
+
"authUrl": "https://idp.example.com/oauth2/authorize",
|
|
919
|
+
"tokenUrl": "https://idp.example.com/oauth2/token",
|
|
920
|
+
"userInfoUrl": "https://idp.example.com/oauth2/userinfo",
|
|
921
|
+
"mapUsername": "email",
|
|
922
|
+
"mapDisplayName": "name",
|
|
923
|
+
"mapFirstName": "given_name",
|
|
924
|
+
"mapLastName": "family_name"
|
|
925
|
+
}
|
|
926
|
+
```
|
|
927
|
+
|
|
928
|
+
### Conditional Provider Access
|
|
929
|
+
|
|
930
|
+
Configure which providers are available based on:
|
|
931
|
+
- **Tenant**: Different IDPs per tenant
|
|
932
|
+
- **Domain**: Email domain-based IDP selection
|
|
933
|
+
- **Application**: Different IDPs per application
|
|
934
|
+
|
|
935
|
+
### Provider Chaining
|
|
936
|
+
|
|
937
|
+
For complex scenarios, you can chain multiple providers:
|
|
938
|
+
1. Primary IDP for employees (e.g., Entra ID)
|
|
939
|
+
2. Secondary IDP for partners (e.g., Okta)
|
|
940
|
+
3. Social IDP for public users (e.g., GitHub)
|
|
941
|
+
|
|
942
|
+
---
|
|
943
|
+
|
|
944
|
+
## API Reference
|
|
945
|
+
|
|
946
|
+
### Get Available Providers
|
|
947
|
+
|
|
948
|
+
```bash
|
|
949
|
+
GET /api/auth/providers
|
|
950
|
+
|
|
951
|
+
Response:
|
|
952
|
+
[
|
|
953
|
+
{
|
|
954
|
+
"name": "okta",
|
|
955
|
+
"type": "okta",
|
|
956
|
+
"displayName": "Okta",
|
|
957
|
+
"active": true
|
|
958
|
+
},
|
|
959
|
+
{
|
|
960
|
+
"name": "entra-id",
|
|
961
|
+
"type": "entra-id",
|
|
962
|
+
"displayName": "Microsoft Entra ID",
|
|
963
|
+
"active": true
|
|
964
|
+
}
|
|
965
|
+
]
|
|
966
|
+
```
|
|
967
|
+
|
|
968
|
+
### Login with Provider
|
|
969
|
+
|
|
970
|
+
```bash
|
|
971
|
+
GET /auth/login?provider=okta&returnTo=/dashboard
|
|
972
|
+
|
|
973
|
+
# Redirects to IDP login page
|
|
974
|
+
# After success, redirects to returnTo URL
|
|
975
|
+
```
|
|
976
|
+
|
|
977
|
+
### Logout
|
|
978
|
+
|
|
979
|
+
```bash
|
|
980
|
+
POST /auth/logout
|
|
981
|
+
|
|
982
|
+
# Clears platform session
|
|
983
|
+
# Optionally redirects to IDP logout
|
|
984
|
+
```
|
|
985
|
+
|
|
986
|
+
---
|
|
987
|
+
|
|
988
|
+
## Related Documentation
|
|
989
|
+
|
|
990
|
+
- **[Authentication System Architecture](/_/docs/architecture/authentication-system/)** - Deep dive into authentication architecture
|
|
991
|
+
- **[Authorization System](/_/docs/architecture/authorization-system/)** - Understanding RBAC and permissions
|
|
992
|
+
- **[Multi-Tenancy](/_/docs/architecture/multi-tenancy/)** - Tenant isolation and management
|
|
993
|
+
- **[Gateway Architecture](/_/docs/architecture/gateway-architecture/)** - How gateway handles authentication
|
|
994
|
+
|
|
995
|
+
---
|
|
996
|
+
|
|
997
|
+
## Support
|
|
998
|
+
|
|
999
|
+
For issues with identity provider configuration:
|
|
1000
|
+
|
|
1001
|
+
1. **Check Logs**: Gateway service logs contain detailed OAuth flow information
|
|
1002
|
+
2. **Review IDP Documentation**: Each IDP has specific requirements and quirks
|
|
1003
|
+
3. **Test Credentials**: Verify client ID and secret are correct
|
|
1004
|
+
4. **Verify Redirect URIs**: Ensure they match between platform and IDP
|
|
1005
|
+
5. **Check Permissions**: Verify IDP app has necessary permissions (groups, user info, etc.)
|
|
1006
|
+
|
|
1007
|
+
If problems persist, enable debug logging and review the complete OAuth flow in the logs.
|