@owlmeans/server-oidc-rp 0.1.2 → 0.1.3
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/README.md +59 -474
- package/build/actions/init.d.ts +2 -2
- package/build/actions/init.d.ts.map +1 -1
- package/build/actions/init.js +2 -2
- package/build/actions/init.js.map +1 -1
- package/build/actions/process.d.ts +2 -2
- package/build/actions/process.d.ts.map +1 -1
- package/build/actions/process.js.map +1 -1
- package/build/auth/plugins/google-client.d.ts +4 -0
- package/build/auth/plugins/google-client.d.ts.map +1 -0
- package/build/auth/plugins/google-client.js +147 -0
- package/build/auth/plugins/google-client.js.map +1 -0
- package/build/auth/plugins/index.d.ts.map +1 -1
- package/build/auth/plugins/index.js +3 -1
- package/build/auth/plugins/index.js.map +1 -1
- package/build/gate.d.ts +1 -1
- package/build/gate.d.ts.map +1 -1
- package/build/guard.d.ts +2 -2
- package/build/guard.d.ts.map +1 -1
- package/build/guard.js +1 -1
- package/build/guard.js.map +1 -1
- package/build/index.d.ts +1 -1
- package/build/index.d.ts.map +1 -1
- package/build/index.js.map +1 -1
- package/build/model/gate.js +1 -1
- package/build/model/gate.js.map +1 -1
- package/build/modules.d.ts +2 -2
- package/build/modules.d.ts.map +1 -1
- package/build/modules.js +3 -3
- package/build/modules.js.map +1 -1
- package/build/service.d.ts.map +1 -1
- package/build/service.js +15 -7
- package/build/service.js.map +1 -1
- package/build/types.d.ts +44 -7
- package/build/types.d.ts.map +1 -1
- package/build/utils/auth.d.ts +2 -2
- package/build/utils/auth.d.ts.map +1 -1
- package/build/utils/auth.js.map +1 -1
- package/build/utils/types.d.ts +3 -2
- package/build/utils/types.d.ts.map +1 -1
- package/build/wrapper.js +2 -2
- package/build/wrapper.js.map +1 -1
- package/package.json +24 -20
- package/src/actions/init.ts +5 -5
- package/src/actions/process.ts +2 -2
- package/src/auth/plugins/google-client.ts +189 -0
- package/src/auth/plugins/index.ts +3 -1
- package/src/gate.ts +1 -1
- package/src/guard.ts +3 -3
- package/src/index.ts +17 -1
- package/src/model/gate.ts +2 -2
- package/src/modules.ts +6 -6
- package/src/service.ts +22 -12
- package/src/types.ts +67 -8
- package/src/utils/auth.ts +2 -3
- package/src/utils/types.ts +3 -2
- package/src/wrapper.ts +8 -8
- package/tests/context.ts +44 -0
- package/tests/google-client.spec.ts +123 -0
- package/tests/service.spec.ts +75 -0
- package/tests/tsconfig.json +12 -0
- package/tsconfig.json +6 -5
- package/build/.gitkeep +0 -0
package/README.md
CHANGED
|
@@ -1,520 +1,105 @@
|
|
|
1
1
|
# @owlmeans/server-oidc-rp
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Server-side OIDC relying party — registers the OIDC guard, wrapping service, gate, and IdP-side client wiring.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Overview
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
-
|
|
10
|
-
-
|
|
11
|
-
-
|
|
12
|
-
-
|
|
13
|
-
- **Security Integration**: Integrate with OwlMeans authentication and authorization system
|
|
14
|
-
- **Module-based Authentication**: Provide OIDC guards and gates for route protection
|
|
15
|
-
|
|
16
|
-
## Key Concepts
|
|
17
|
-
|
|
18
|
-
### OpenID Connect Relying Party
|
|
19
|
-
A Relying Party (RP) is an OAuth 2.0 client application that uses OpenID Connect to verify the identity of end-users. This package implements server-side RP functionality.
|
|
20
|
-
|
|
21
|
-
### Provider Configuration
|
|
22
|
-
The package supports multiple OIDC providers with configuration including discovery URLs, client credentials, and service mappings.
|
|
23
|
-
|
|
24
|
-
### Account Linking
|
|
25
|
-
Enables linking external OIDC provider accounts with internal user accounts, supporting both automatic linking and manual credential mapping.
|
|
26
|
-
|
|
27
|
-
### Token Management
|
|
28
|
-
Comprehensive token lifecycle management including acquisition, refresh, introspection, and validation.
|
|
7
|
+
- `appendOidcGuard(context)` — registers the OIDC guard service
|
|
8
|
+
- `makeOidcWrappingService()` / `makeOidcGate()` — token wrapping service and gate factory
|
|
9
|
+
- `setupOidcGuard(modules, coguards?, extras?)` — attaches the OIDC guard to module declarations
|
|
10
|
+
- `setupAuthServiceModules(...)` — wires external auth modules
|
|
11
|
+
- `makeOidcClientService()` / `OidcClientService` — IdP-side client (e.g., Keycloak admin)
|
|
12
|
+
- Subpath `./auth` — admin-client constants like `OIDC_ADMIN_CLIENT`
|
|
29
13
|
|
|
30
14
|
## Installation
|
|
31
15
|
|
|
32
16
|
```bash
|
|
33
|
-
|
|
17
|
+
bun add @owlmeans/server-oidc-rp
|
|
34
18
|
```
|
|
35
19
|
|
|
36
|
-
##
|
|
37
|
-
|
|
38
|
-
### Types
|
|
20
|
+
## Usage
|
|
39
21
|
|
|
40
|
-
|
|
41
|
-
Main service interface for OIDC client operations.
|
|
22
|
+
Register services in `context.ts`:
|
|
42
23
|
|
|
43
24
|
```typescript
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
getConfig(clientId: string | Partial<OidcProviderConfig>): Promise<OidcProviderConfig | undefined>
|
|
48
|
-
getDefault(): string | undefined
|
|
49
|
-
|
|
50
|
-
registerTemporaryProvider(config: OidcProviderConfig): OidcProviderConfig
|
|
51
|
-
unregisterTemporaryProvider(params: Partial<OidcProviderConfig>): void
|
|
52
|
-
hasProvider(params: Partial<OidcProviderConfig>): boolean
|
|
53
|
-
entityToClientId(params: Partial<OidcProviderConfig>): string
|
|
54
|
-
|
|
55
|
-
providerApi(): ProviderApiService | null
|
|
56
|
-
accountLinking(): AccountLinkingService | null
|
|
57
|
-
}
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
#### `OidcClientAdapter`
|
|
61
|
-
Interface for individual OIDC client instances.
|
|
25
|
+
import {
|
|
26
|
+
appendOidcGuard, makeOidcWrappingService, makeOidcGate, makeOidcClientService
|
|
27
|
+
} from '@owlmeans/server-oidc-rp'
|
|
62
28
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
getConfig(): OidcProviderConfig
|
|
68
|
-
makeAuthUrl(params: Record<string, string>): string
|
|
69
|
-
grantWithCredentials(): Promise<TokenSet>
|
|
70
|
-
grantWithCode(currentUrl: string, checks: AuthorizationCodeGrantChecks, params: Record<string, string>): Promise<TokenSet>
|
|
71
|
-
refresh(tokenSet: TokenSetParameters | string): Promise<TokenSetParameters>
|
|
72
|
-
introspect(tokenSet: TokenSetParameters, type?: string): Promise<IntrospectionResponse>
|
|
73
|
-
}
|
|
29
|
+
context.registerService(makeOidcWrappingService())
|
|
30
|
+
context.registerService(makeOidcGate())
|
|
31
|
+
context.registerService(makeOidcClientService())
|
|
32
|
+
appendOidcGuard<C, T>(context)
|
|
74
33
|
```
|
|
75
34
|
|
|
76
|
-
|
|
77
|
-
Service interface for linking OIDC accounts with internal profiles.
|
|
35
|
+
Wire onto modules in `modules.ts`:
|
|
78
36
|
|
|
79
37
|
```typescript
|
|
80
|
-
|
|
81
|
-
getLinkedProfile(details: ProviderProfileDetails): Promise<AuthPayload | null>
|
|
82
|
-
linkProfile(details: ProviderProfileDetails, meta: AccountMeta): Promise<AuthPayload>
|
|
83
|
-
linkCredentials(details: ProviderProfileDetails): Promise<AuthPayload>
|
|
84
|
-
getOwnerProfiles(entityId: string): Promise<Profile[]>
|
|
85
|
-
getOwnerCredentials(userId: string, entityId?: string, type?: string): Promise<AuthCredentials | undefined>
|
|
86
|
-
}
|
|
87
|
-
```
|
|
38
|
+
import { setupOidcGuard, setupAuthServiceModules } from '@owlmeans/server-oidc-rp'
|
|
88
39
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
```typescript
|
|
93
|
-
interface ProviderApiService extends InitializedService {
|
|
94
|
-
getUserDetails(token: string, userId: string): Promise<OidcUserDetails>
|
|
95
|
-
getSettings(token: string, realm: string): Promise<OidcProviderSettings>
|
|
96
|
-
}
|
|
40
|
+
setupOidcGuard(appModules)
|
|
41
|
+
setupAuthServiceModules(appModules)
|
|
97
42
|
```
|
|
98
43
|
|
|
99
|
-
|
|
100
|
-
Configuration interface extending ServerConfig.
|
|
101
|
-
|
|
102
|
-
```typescript
|
|
103
|
-
interface Config extends ServerConfig, WithSharedConfig {
|
|
104
|
-
oidc: OidcRpConfig
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
interface OidcRpConfig extends OidcSharedConfig {
|
|
108
|
-
accountLinkingService?: string
|
|
109
|
-
providerApiService?: string
|
|
110
|
-
}
|
|
111
|
-
```
|
|
112
|
-
|
|
113
|
-
### Factory Functions
|
|
114
|
-
|
|
115
|
-
#### `makeOidcClientService(alias?: string): OidcClientService`
|
|
116
|
-
|
|
117
|
-
Creates an OIDC client service instance.
|
|
118
|
-
|
|
119
|
-
**Parameters:**
|
|
120
|
-
- `alias`: Service alias (defaults to 'oidc-client')
|
|
121
|
-
|
|
122
|
-
**Returns:** OidcClientService instance
|
|
123
|
-
|
|
124
|
-
```typescript
|
|
125
|
-
import { makeOidcClientService } from '@owlmeans/server-oidc-rp'
|
|
126
|
-
|
|
127
|
-
const oidcService = makeOidcClientService('my-oidc-client')
|
|
128
|
-
```
|
|
129
|
-
|
|
130
|
-
### Guard Functions
|
|
131
|
-
|
|
132
|
-
#### `appendOidcGuard<C extends Config, T extends Context<C>>(context: T, opts?: OidcGuardOptions): T`
|
|
133
|
-
|
|
134
|
-
Appends OIDC guard functionality to a context.
|
|
135
|
-
|
|
136
|
-
**Parameters:**
|
|
137
|
-
- `context`: Server context instance
|
|
138
|
-
- `opts`: Optional OIDC guard configuration
|
|
139
|
-
|
|
140
|
-
**Returns:** Enhanced context with OIDC guard capabilities
|
|
44
|
+
Configure providers in `config.ts`:
|
|
141
45
|
|
|
142
46
|
```typescript
|
|
143
|
-
import {
|
|
47
|
+
import { OIDC_ADMIN_CLIENT } from '@owlmeans/server-oidc-rp/auth'
|
|
144
48
|
|
|
145
|
-
|
|
146
|
-
|
|
49
|
+
cfg.oidc ??= {}
|
|
50
|
+
cfg.oidc.providers ??= []
|
|
51
|
+
cfg.oidc.providers.push({
|
|
52
|
+
clientId: OIDC_ADMIN_CLIENT,
|
|
53
|
+
basePath: 'realms/master',
|
|
54
|
+
service: OIDC_PRODUCT,
|
|
55
|
+
secret: '/etc/master-secret/oidc-admin-secret',
|
|
56
|
+
internal: true
|
|
147
57
|
})
|
|
148
58
|
```
|
|
149
59
|
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
Sets up OIDC guard functionality for modules.
|
|
153
|
-
|
|
154
|
-
**Parameters:**
|
|
155
|
-
- `modules`: Array of modules to enhance
|
|
156
|
-
- `coguards`: Optional co-guard configurations
|
|
60
|
+
Use the IdP-side client in a service:
|
|
157
61
|
|
|
158
62
|
```typescript
|
|
159
|
-
import {
|
|
63
|
+
import { DEFAULT_ALIAS as OIDC_SERVICE } from '@owlmeans/server-oidc-rp'
|
|
64
|
+
import type { OidcClientService } from '@owlmeans/server-oidc-rp'
|
|
160
65
|
|
|
161
|
-
|
|
66
|
+
const oidc = context.service<OidcClientService>(OIDC_SERVICE)
|
|
162
67
|
```
|
|
163
68
|
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
#### `setupAuthServiceModules(modules: CommonModule[], serviceAlias: string, prefix?: string): void`
|
|
69
|
+
## API
|
|
167
70
|
|
|
168
|
-
|
|
71
|
+
### Service factories
|
|
169
72
|
|
|
170
|
-
|
|
171
|
-
- `
|
|
172
|
-
- `
|
|
173
|
-
- `
|
|
73
|
+
- `appendOidcGuard<C, T>(context): T` — register the OIDC guard
|
|
74
|
+
- `makeOidcWrappingService(alias?)` — token-wrapping service
|
|
75
|
+
- `makeOidcGate(alias?)` — gate factory
|
|
76
|
+
- `makeOidcClientService(alias?)` — IdP-side client (used to call OIDC admin API)
|
|
174
77
|
|
|
175
|
-
|
|
176
|
-
import { setupAuthServiceModules } from '@owlmeans/server-oidc-rp'
|
|
78
|
+
### Module wiring
|
|
177
79
|
|
|
178
|
-
|
|
179
|
-
|
|
80
|
+
- `setupOidcGuard(modules, coguards?, extras?)` — attach guard to module declarations
|
|
81
|
+
- `setupAuthServiceModules(modules, ...)` — register external auth modules
|
|
180
82
|
|
|
181
83
|
### Constants
|
|
182
84
|
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
const DEF_OIDC_ACCOUNT_LINKING = 'oidc-consumer-account-linking'
|
|
187
|
-
const DEF_OIDC_PROVIDER_API = 'oidc-consumer-provider-api'
|
|
188
|
-
```
|
|
189
|
-
|
|
190
|
-
#### Route Definitions
|
|
191
|
-
```typescript
|
|
192
|
-
const authService = {
|
|
193
|
-
provider: {
|
|
194
|
-
list: 'external-auth:provider:list'
|
|
195
|
-
},
|
|
196
|
-
auth: {
|
|
197
|
-
update: 'external-auth:auth:update'
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
```
|
|
201
|
-
|
|
202
|
-
#### Cache and Timing Constants
|
|
203
|
-
```typescript
|
|
204
|
-
const OIDC_TOKEN_STORE = 'oidc-token-store'
|
|
205
|
-
const PROVIDER_CACHE_TTL = (5 * 60 - 1) * 1000 // ~5 minutes
|
|
206
|
-
const OIDC_AUTH_LIFTETIME = 24 * 3600 * 1000 // 24 hours
|
|
207
|
-
const OIDC_WRAP_FRESHNESS = (5 * 60 - 1) * 1000 // ~5 minutes
|
|
208
|
-
```
|
|
209
|
-
|
|
210
|
-
## Usage Examples
|
|
211
|
-
|
|
212
|
-
### Basic OIDC Client Setup
|
|
85
|
+
- `DEFAULT_ALIAS` — `'oidc-client'`
|
|
86
|
+
- `OIDC_TOKEN_STORE`, `PROVIDER_CACHE_TTL`, `OIDC_AUTH_LIFTETIME`, `OIDC_WRAP_FRESHNESS`
|
|
87
|
+
- `./auth` subpath: `OIDC_ADMIN_CLIENT` and related admin-client constants
|
|
213
88
|
|
|
214
|
-
|
|
215
|
-
import { makeOidcClientService, setupOidcGuard } from '@owlmeans/server-oidc-rp'
|
|
216
|
-
import { makeServerContext, makeServerConfig } from '@owlmeans/server-context'
|
|
217
|
-
|
|
218
|
-
// Create server context with OIDC configuration
|
|
219
|
-
const config = makeServerConfig('auth-server', {
|
|
220
|
-
oidc: {
|
|
221
|
-
providers: [{
|
|
222
|
-
clientId: 'my-app',
|
|
223
|
-
secret: 'client-secret',
|
|
224
|
-
service: 'keycloak',
|
|
225
|
-
basePath: '/realms/my-realm',
|
|
226
|
-
def: true
|
|
227
|
-
}]
|
|
228
|
-
}
|
|
229
|
-
})
|
|
230
|
-
|
|
231
|
-
const context = makeServerContext(config)
|
|
232
|
-
|
|
233
|
-
// Create and register OIDC client service
|
|
234
|
-
const oidcService = makeOidcClientService()
|
|
235
|
-
context.registerService(oidcService)
|
|
236
|
-
|
|
237
|
-
// Initialize context
|
|
238
|
-
await context.configure().init()
|
|
239
|
-
```
|
|
240
|
-
|
|
241
|
-
### Using OIDC Client
|
|
242
|
-
|
|
243
|
-
```typescript
|
|
244
|
-
// Get the OIDC service
|
|
245
|
-
const oidcService = context.service<OidcClientService>('oidc-client')
|
|
246
|
-
|
|
247
|
-
// Get OIDC client for default provider
|
|
248
|
-
const defaultClientId = oidcService.getDefault()
|
|
249
|
-
const client = await oidcService.getClient(defaultClientId!)
|
|
250
|
-
|
|
251
|
-
// Create authorization URL
|
|
252
|
-
const authUrl = client.makeAuthUrl({
|
|
253
|
-
redirect_uri: 'https://myapp.com/callback',
|
|
254
|
-
scope: 'openid profile email',
|
|
255
|
-
state: 'random-state'
|
|
256
|
-
})
|
|
257
|
-
|
|
258
|
-
console.log('Redirect user to:', authUrl)
|
|
259
|
-
```
|
|
260
|
-
|
|
261
|
-
### Authorization Code Flow
|
|
262
|
-
|
|
263
|
-
```typescript
|
|
264
|
-
// Handle callback from OIDC provider
|
|
265
|
-
app.get('/callback', async (req, res) => {
|
|
266
|
-
const client = await oidcService.getClient('my-app')
|
|
267
|
-
|
|
268
|
-
try {
|
|
269
|
-
const tokenSet = await client.grantWithCode(
|
|
270
|
-
req.url,
|
|
271
|
-
{
|
|
272
|
-
state: req.query.state,
|
|
273
|
-
code_verifier: 'stored-code-verifier' // if using PKCE
|
|
274
|
-
},
|
|
275
|
-
{ flow: 'authorization_code' }
|
|
276
|
-
)
|
|
277
|
-
|
|
278
|
-
console.log('Access token:', tokenSet.access_token)
|
|
279
|
-
console.log('ID token:', tokenSet.id_token)
|
|
280
|
-
|
|
281
|
-
// Store tokens securely
|
|
282
|
-
res.redirect('/dashboard')
|
|
283
|
-
} catch (error) {
|
|
284
|
-
console.error('OIDC authentication failed:', error)
|
|
285
|
-
res.redirect('/login?error=auth_failed')
|
|
286
|
-
}
|
|
287
|
-
})
|
|
288
|
-
```
|
|
289
|
-
|
|
290
|
-
### Client Credentials Flow
|
|
291
|
-
|
|
292
|
-
```typescript
|
|
293
|
-
// Get access token using client credentials
|
|
294
|
-
const client = await oidcService.getClient('service-account')
|
|
295
|
-
const tokenSet = await client.grantWithCredentials()
|
|
296
|
-
|
|
297
|
-
console.log('Service access token:', tokenSet.access_token)
|
|
298
|
-
|
|
299
|
-
// Use token for API calls
|
|
300
|
-
const response = await fetch('https://api.service.com/data', {
|
|
301
|
-
headers: {
|
|
302
|
-
'Authorization': `Bearer ${tokenSet.access_token}`
|
|
303
|
-
}
|
|
304
|
-
})
|
|
305
|
-
```
|
|
306
|
-
|
|
307
|
-
### Token Refresh
|
|
308
|
-
|
|
309
|
-
```typescript
|
|
310
|
-
// Refresh an expired token
|
|
311
|
-
try {
|
|
312
|
-
const newTokenSet = await client.refresh(oldTokenSet)
|
|
313
|
-
console.log('New access token:', newTokenSet.access_token)
|
|
314
|
-
} catch (error) {
|
|
315
|
-
console.error('Token refresh failed:', error)
|
|
316
|
-
// Redirect to login
|
|
317
|
-
}
|
|
318
|
-
```
|
|
319
|
-
|
|
320
|
-
### Token Introspection
|
|
321
|
-
|
|
322
|
-
```typescript
|
|
323
|
-
// Validate and introspect a token
|
|
324
|
-
const introspection = await client.introspect(tokenSet, 'access_token')
|
|
325
|
-
|
|
326
|
-
if (introspection.active) {
|
|
327
|
-
console.log('Token is valid')
|
|
328
|
-
console.log('Token expires at:', new Date(introspection.exp! * 1000))
|
|
329
|
-
console.log('Token subject:', introspection.sub)
|
|
330
|
-
} else {
|
|
331
|
-
console.log('Token is invalid or expired')
|
|
332
|
-
}
|
|
333
|
-
```
|
|
334
|
-
|
|
335
|
-
### Multiple Provider Configuration
|
|
336
|
-
|
|
337
|
-
```typescript
|
|
338
|
-
const config = makeServerConfig('multi-provider-app', {
|
|
339
|
-
oidc: {
|
|
340
|
-
providers: [
|
|
341
|
-
{
|
|
342
|
-
clientId: 'keycloak-client',
|
|
343
|
-
secret: 'secret1',
|
|
344
|
-
service: 'keycloak',
|
|
345
|
-
basePath: '/realms/main',
|
|
346
|
-
def: true
|
|
347
|
-
},
|
|
348
|
-
{
|
|
349
|
-
clientId: 'google-client',
|
|
350
|
-
secret: 'secret2',
|
|
351
|
-
discoveryUrl: 'https://accounts.google.com/.well-known/openid_configuration'
|
|
352
|
-
}
|
|
353
|
-
]
|
|
354
|
-
}
|
|
355
|
-
})
|
|
356
|
-
|
|
357
|
-
// Get specific provider clients
|
|
358
|
-
const keycloakClient = await oidcService.getClient('keycloak-client')
|
|
359
|
-
const googleClient = await oidcService.getClient('google-client')
|
|
360
|
-
```
|
|
361
|
-
|
|
362
|
-
### Account Linking
|
|
363
|
-
|
|
364
|
-
```typescript
|
|
365
|
-
// Setup account linking service
|
|
366
|
-
const accountLinkingService: AccountLinkingService = createService('account-linking', {
|
|
367
|
-
getLinkedProfile: async (details) => {
|
|
368
|
-
// Check if external profile is already linked
|
|
369
|
-
const existing = await database.findLinkedAccount(details.sub, details.iss)
|
|
370
|
-
return existing ? existing.authPayload : null
|
|
371
|
-
},
|
|
372
|
-
|
|
373
|
-
linkProfile: async (details, meta) => {
|
|
374
|
-
// Link external account to existing user
|
|
375
|
-
const user = await database.findUserByUsername(meta.username)
|
|
376
|
-
await database.linkExternalAccount(user.id, details)
|
|
377
|
-
return createAuthPayload(user)
|
|
378
|
-
},
|
|
379
|
-
|
|
380
|
-
linkCredentials: async (details) => {
|
|
381
|
-
// Auto-link based on email or other criteria
|
|
382
|
-
const user = await database.findUserByEmail(details.email)
|
|
383
|
-
if (user) {
|
|
384
|
-
await database.linkExternalAccount(user.id, details)
|
|
385
|
-
return createAuthPayload(user)
|
|
386
|
-
}
|
|
387
|
-
throw new Error('No matching user found')
|
|
388
|
-
}
|
|
389
|
-
})
|
|
390
|
-
|
|
391
|
-
context.registerService(accountLinkingService)
|
|
392
|
-
```
|
|
393
|
-
|
|
394
|
-
### Module Protection with OIDC Guards
|
|
395
|
-
|
|
396
|
-
```typescript
|
|
397
|
-
import { module, guard } from '@owlmeans/module'
|
|
398
|
-
import { route } from '@owlmeans/route'
|
|
399
|
-
|
|
400
|
-
// Create protected modules
|
|
401
|
-
const protectedModules = [
|
|
402
|
-
module(route('profile', '/profile'), guard('oidc-authenticated')),
|
|
403
|
-
module(route('admin', '/admin'), guard(['oidc-authenticated', 'admin-role']))
|
|
404
|
-
]
|
|
405
|
-
|
|
406
|
-
// Setup OIDC guards
|
|
407
|
-
setupOidcGuard(protectedModules, 'oidc-authenticated')
|
|
408
|
-
```
|
|
409
|
-
|
|
410
|
-
## Error Handling
|
|
411
|
-
|
|
412
|
-
The package throws `AuthManagerError` for various OIDC-related issues:
|
|
413
|
-
|
|
414
|
-
```typescript
|
|
415
|
-
import { AuthManagerError } from '@owlmeans/auth'
|
|
416
|
-
|
|
417
|
-
try {
|
|
418
|
-
const client = await oidcService.getClient('invalid-client')
|
|
419
|
-
} catch (error) {
|
|
420
|
-
if (error instanceof AuthManagerError) {
|
|
421
|
-
switch (error.message) {
|
|
422
|
-
case 'oidc.client.basepath':
|
|
423
|
-
console.error('OIDC provider base path not configured')
|
|
424
|
-
break
|
|
425
|
-
case 'oidc.client.service':
|
|
426
|
-
console.error('OIDC provider service not specified')
|
|
427
|
-
break
|
|
428
|
-
case 'oidc.client.client-id':
|
|
429
|
-
console.error('OIDC client ID missing')
|
|
430
|
-
break
|
|
431
|
-
case 'oidc.client.secert':
|
|
432
|
-
console.error('OIDC client secret missing')
|
|
433
|
-
break
|
|
434
|
-
default:
|
|
435
|
-
console.error('OIDC error:', error.message)
|
|
436
|
-
}
|
|
437
|
-
}
|
|
438
|
-
}
|
|
439
|
-
```
|
|
440
|
-
|
|
441
|
-
## Integration Patterns
|
|
442
|
-
|
|
443
|
-
### Express.js Integration
|
|
444
|
-
|
|
445
|
-
```typescript
|
|
446
|
-
import express from 'express'
|
|
447
|
-
import { makeOidcClientService } from '@owlmeans/server-oidc-rp'
|
|
448
|
-
|
|
449
|
-
const app = express()
|
|
450
|
-
|
|
451
|
-
// OIDC login route
|
|
452
|
-
app.get('/login/:provider?', async (req, res) => {
|
|
453
|
-
const providerId = req.params.provider || oidcService.getDefault()
|
|
454
|
-
const client = await oidcService.getClient(providerId!)
|
|
455
|
-
|
|
456
|
-
const authUrl = client.makeAuthUrl({
|
|
457
|
-
redirect_uri: `${req.protocol}://${req.get('host')}/callback`,
|
|
458
|
-
scope: 'openid profile email',
|
|
459
|
-
state: generateState()
|
|
460
|
-
})
|
|
461
|
-
|
|
462
|
-
res.redirect(authUrl)
|
|
463
|
-
})
|
|
464
|
-
|
|
465
|
-
// OIDC callback route
|
|
466
|
-
app.get('/callback', async (req, res) => {
|
|
467
|
-
// Handle authorization code flow as shown above
|
|
468
|
-
})
|
|
469
|
-
```
|
|
470
|
-
|
|
471
|
-
### API Gateway Integration
|
|
472
|
-
|
|
473
|
-
```typescript
|
|
474
|
-
// Create API gateway with OIDC token validation
|
|
475
|
-
const validateToken = async (req: Request) => {
|
|
476
|
-
const authHeader = req.headers.authorization
|
|
477
|
-
if (!authHeader?.startsWith('Bearer ')) {
|
|
478
|
-
throw new Error('Missing or invalid authorization header')
|
|
479
|
-
}
|
|
480
|
-
|
|
481
|
-
const token = authHeader.substring(7)
|
|
482
|
-
const client = await oidcService.getClient(oidcService.getDefault()!)
|
|
483
|
-
|
|
484
|
-
const introspection = await client.introspect({ access_token: token })
|
|
485
|
-
if (!introspection.active) {
|
|
486
|
-
throw new Error('Invalid or expired token')
|
|
487
|
-
}
|
|
488
|
-
|
|
489
|
-
return introspection
|
|
490
|
-
}
|
|
491
|
-
```
|
|
492
|
-
|
|
493
|
-
## Best Practices
|
|
89
|
+
### Types
|
|
494
90
|
|
|
495
|
-
|
|
496
|
-
2. **Token Storage**: Store tokens securely with appropriate encryption and expiration handling
|
|
497
|
-
3. **Error Handling**: Implement comprehensive error handling for all OIDC operations
|
|
498
|
-
4. **Provider Discovery**: Use OIDC discovery when possible for automatic configuration
|
|
499
|
-
5. **Token Validation**: Always validate tokens before using them for authorization decisions
|
|
500
|
-
6. **Account Linking**: Implement secure account linking with proper user consent flows
|
|
501
|
-
7. **Monitoring**: Monitor OIDC operations for security and performance issues
|
|
91
|
+
`OidcClientService`, RP config types — exported from the root entry.
|
|
502
92
|
|
|
503
|
-
##
|
|
93
|
+
## Product-Viable Integration Notes
|
|
504
94
|
|
|
505
|
-
|
|
506
|
-
-
|
|
507
|
-
-
|
|
508
|
-
-
|
|
509
|
-
- `@owlmeans/oidc` - Core OIDC functionality
|
|
510
|
-
- `@owlmeans/server-context` - Server context management
|
|
511
|
-
- `@owlmeans/server-module` - Server module system
|
|
512
|
-
- `openid-client` - OpenID Connect client library
|
|
513
|
-
- `jose` - JSON Web Token utilities
|
|
95
|
+
- `makeOidcClientService()` reads provider descriptors from `cfg.oidc.providers`, including Google and internal admin providers.
|
|
96
|
+
- Use `findProvider(predicate)`, `hasProvider(params)`, and `entityToClientId(params)` for provider lookup rather than ad hoc config scans.
|
|
97
|
+
- `setupAuthServiceModules(managerModules, AUTH_API)` wires provider-list and token-update endpoints protected by `GUARD_ED25519`.
|
|
98
|
+
- If OIDC/Google is only the login provider and local identity records hold authorization, do not re-add `appendOidcGuard()`, `makeOidcGate()`, or `setupOidcGuard()` as product authorization. Use a product-specific `GateService` over local profile scopes.
|
|
514
99
|
|
|
515
100
|
## Related Packages
|
|
516
101
|
|
|
517
|
-
- [`@owlmeans/
|
|
518
|
-
- [`@owlmeans/
|
|
519
|
-
- [`@owlmeans/server-
|
|
520
|
-
- [`@owlmeans/auth`](../auth) -
|
|
102
|
+
- [`@owlmeans/oidc`](../oidc) — shared `OIDC_GATE`, `OIDC_GUARD`, types
|
|
103
|
+
- [`@owlmeans/server-auth`](../server-auth) — works alongside the OIDC guard for token verification
|
|
104
|
+
- [`@owlmeans/server-context`](../server-context) — base context where services are registered
|
|
105
|
+
- [`@owlmeans/auth-common`](../auth-common) — `DEFAULT_GUARD` co-attached via `setupOidcGuard`
|
package/build/actions/init.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export declare const init:
|
|
1
|
+
import type { RefedEntrypointHandler } from '@owlmeans/server-entrypoint';
|
|
2
|
+
export declare const init: RefedEntrypointHandler;
|
|
3
3
|
//# sourceMappingURL=init.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/actions/init.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/actions/init.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAA;AAiBzE,eAAO,MAAM,IAAI,EAAE,sBAmFjB,CAAA"}
|
package/build/actions/init.js
CHANGED
|
@@ -27,7 +27,7 @@ export const init = handleBody(async (body, ctx) => {
|
|
|
27
27
|
* @TODO We need to move it to some remote resource.
|
|
28
28
|
* And make oidc service itself use such a resource to get required client.
|
|
29
29
|
*/
|
|
30
|
-
const [providers] = await context.
|
|
30
|
+
const [providers] = await context.entrypoint(authService.provider.list).call({
|
|
31
31
|
params: { service: context.cfg.alias ?? context.cfg.service },
|
|
32
32
|
query: { entityId }
|
|
33
33
|
});
|
|
@@ -64,7 +64,7 @@ export const init = handleBody(async (body, ctx) => {
|
|
|
64
64
|
client: client.getClientId(),
|
|
65
65
|
entityId,
|
|
66
66
|
}, { ttl: AUTHEN_TIMEFRAME / 1000 });
|
|
67
|
-
const [dispatcherUrl] = await context.
|
|
67
|
+
const [dispatcherUrl] = await context.entrypoint(DISPATCHER).call();
|
|
68
68
|
const cfg = client.getConfig();
|
|
69
69
|
const url = client.makeAuthUrl({
|
|
70
70
|
scope: `openid profile email ${cfg?.extraScopes ?? ''}`,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.js","sourceRoot":"","sources":["../../src/actions/init.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AAEjD,OAAO,EAAE,kBAAkB,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAC5E,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAGjD,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AACzD,qDAAqD;AACrD,8CAA8C;AAE9C,OAAO,EAAE,cAAc,IAAI,MAAM,EAAE,MAAM,aAAa,CAAA;AACtD,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AACjD,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAA;AAC3C,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AAExD,MAAM,CAAC,MAAM,IAAI,
|
|
1
|
+
{"version":3,"file":"init.js","sourceRoot":"","sources":["../../src/actions/init.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AAEjD,OAAO,EAAE,kBAAkB,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAC5E,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAGjD,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AACzD,q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CAAC,WAAW,EAAE,EAAE,MAAM,CAAC,CAAA;IAE3H,MAAM,KAAK,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC;QAC1B,EAAE,EAAE,UAAU,CAAC,SAAS,CAAC;QACzB,QAAQ;QACR,MAAM,EAAE,MAAM,CAAC,WAAW,EAAE;QAC5B,QAAQ;KACT,EAAE,EAAE,GAAG,EAAE,gBAAgB,GAAG,IAAI,EAAE,CAAC,CAAA;IAEpC,MAAM,CAAC,aAAa,CAAC,GAAG,MAAM,OAAO,CAAC,UAAU,CAA2B,UAAU,CAAC,CAAC,IAAI,EAAE,CAAA;IAE7F,MAAM,GAAG,GAAG,MAAM,CAAC,SAAS,EAAE,CAAA;IAC9B,MAAM,GAAG,GAAG,MAAM,CAAC,WAAW,CAAC;QAC7B,KAAK,EAAE,wBAAwB,GAAG,EAAE,WAAW,IAAI,EAAE,EAAE;QACvD,cAAc,EAAE,SAAS;QACzB,qBAAqB,EAAE,MAAM;QAC7B,YAAY,EAAE,aAAa;KAC5B,CAAC,CAAA;IAEF,OAAO,CAAC,GAAG,CAAC,YAAY,EAAE,GAAG,CAAC,CAAA;IAE9B,OAAO,GAAG,CAAA;AACZ,CAAC,CAAC,CAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { RefedEntrypointHandler } from '@owlmeans/server-entrypoint';
|
|
2
2
|
/**
|
|
3
3
|
* Authentication method links together OIDC and OwlMeans auth.
|
|
4
4
|
* 1. We authenticate OIDC redirect back params with the classic OIDC client.
|
|
@@ -13,5 +13,5 @@ import type { RefedModuleHandler } from '@owlmeans/server-module';
|
|
|
13
13
|
*
|
|
14
14
|
* ! There is also token renewal mechanism that should be implemented nearby.
|
|
15
15
|
*/
|
|
16
|
-
export declare const authenticate:
|
|
16
|
+
export declare const authenticate: RefedEntrypointHandler;
|
|
17
17
|
//# sourceMappingURL=process.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"process.d.ts","sourceRoot":"","sources":["../../src/actions/process.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"process.d.ts","sourceRoot":"","sources":["../../src/actions/process.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAA;AAkBzE;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,YAAY,EAAE,sBAgFzB,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"process.js","sourceRoot":"","sources":["../../src/actions/process.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AAEjD,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAA;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAEjD,OAAO,GAAG,MAAM,KAAK,CAAA;AACrB,OAAO,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAA;AAEzD,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AACzE,OAAO,EAAE,SAAS,EAAE,MAAM,MAAM,CAAA;AAChC,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAChE,OAAO,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAA;AACnD,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAA;AAC1C,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAA;AAC1E,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAA;AAClD,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAE7C;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,MAAM,YAAY,
|
|
1
|
+
{"version":3,"file":"process.js","sourceRoot":"","sources":["../../src/actions/process.ts"],"names":[],"mappings":"AAC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CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,IAAI,CAAA;IAExD,OAAO,IAAI,CAAA;AACb,CAAC,CAAC,CAAA"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { AuthPlugin } from '@owlmeans/server-auth/manager/plugins';
|
|
2
|
+
import type { Config, Context } from '../../types.js';
|
|
3
|
+
export declare const googleClientPlugin: <C extends Config, T extends Context<C>>(context: T, service?: string) => AuthPlugin;
|
|
4
|
+
//# sourceMappingURL=google-client.d.ts.map
|