@monocloud/auth-core 0.1.3 → 0.1.5
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 +19 -3
- package/dist/index.cjs +101 -65
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +72 -35
- package/dist/index.mjs +75 -40
- package/dist/index.mjs.map +1 -1
- package/dist/types-hokU85Zr.d.mts +1243 -0
- package/dist/utils/index.cjs +19 -19
- package/dist/utils/index.cjs.map +1 -1
- package/dist/utils/index.d.mts +5 -7
- package/dist/utils/index.mjs +5 -6
- package/dist/utils/index.mjs.map +1 -1
- package/dist/utils/internal.cjs +365 -23
- package/dist/utils/internal.cjs.map +1 -0
- package/dist/utils/internal.d.mts +5 -6
- package/dist/utils/internal.mjs +342 -2
- package/dist/utils/internal.mjs.map +1 -0
- package/package.json +4 -4
- package/dist/index.d.cts +0 -274
- package/dist/internal-DXHuqjJJ.mjs +0 -343
- package/dist/internal-DXHuqjJJ.mjs.map +0 -1
- package/dist/internal-DytuO03E.cjs +0 -475
- package/dist/internal-DytuO03E.cjs.map +0 -1
- package/dist/types-CnxqWHwA.d.cts +0 -481
- package/dist/types-DwJl9ZUf.d.mts +0 -481
- package/dist/utils/index.d.cts +0 -106
- package/dist/utils/internal.d.cts +0 -209
|
@@ -0,0 +1,1243 @@
|
|
|
1
|
+
//#region src/types.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Supported OAuth 2.0 / OpenID Connect response types.
|
|
4
|
+
*
|
|
5
|
+
* Response types determine which artifacts are returned from the authorization endpoint during authentication.
|
|
6
|
+
*
|
|
7
|
+
* > Modern applications should prefer the Authorization Code Flow (`code`) with PKCE. Implicit flow variants are included for compatibility with legacy or specialized scenarios.
|
|
8
|
+
*
|
|
9
|
+
* @category Types (Enums)
|
|
10
|
+
*/
|
|
11
|
+
type ResponseTypes =
|
|
12
|
+
/**
|
|
13
|
+
* Authorization Code Flow (recommended). Returns an authorization code that is exchanged for tokens server-side.
|
|
14
|
+
*/
|
|
15
|
+
'code'
|
|
16
|
+
/**
|
|
17
|
+
* Implicit Flow returning an access token directly from the authorization endpoint.
|
|
18
|
+
*/
|
|
19
|
+
| 'token'
|
|
20
|
+
/**
|
|
21
|
+
* Implicit Flow returning an ID token.
|
|
22
|
+
*/
|
|
23
|
+
| 'id_token'
|
|
24
|
+
/**
|
|
25
|
+
* Implicit Flow returning both an ID token and an access token.
|
|
26
|
+
*/
|
|
27
|
+
| 'id_token token'
|
|
28
|
+
/**
|
|
29
|
+
* Hybrid Flow returning an authorization code and an ID token.
|
|
30
|
+
*/
|
|
31
|
+
| 'code id_token'
|
|
32
|
+
/**
|
|
33
|
+
* Hybrid Flow returning an authorization code and an access token.
|
|
34
|
+
*/
|
|
35
|
+
| 'code token'
|
|
36
|
+
/**
|
|
37
|
+
* Hybrid Flow returning an authorization code, ID token, and access token.
|
|
38
|
+
*/
|
|
39
|
+
| 'code id_token token';
|
|
40
|
+
/**
|
|
41
|
+
* Supported PKCE (Proof Key for Code Exchange) code challenge methods.
|
|
42
|
+
*
|
|
43
|
+
* PKCE protects authorization code flows by binding the authorization request to the token exchange using a cryptographic verifier.
|
|
44
|
+
*
|
|
45
|
+
* @category Types (Enums)
|
|
46
|
+
*/
|
|
47
|
+
type CodeChallengeMethod =
|
|
48
|
+
/**
|
|
49
|
+
* Uses the code verifier directly as the challenge. Not recommended for production use.
|
|
50
|
+
*/
|
|
51
|
+
'plain'
|
|
52
|
+
/**
|
|
53
|
+
* Uses a SHA-256 hash of the code verifier.
|
|
54
|
+
*/
|
|
55
|
+
| 'S256';
|
|
56
|
+
/**
|
|
57
|
+
* Supported OpenID Connect `display` parameter values.
|
|
58
|
+
*
|
|
59
|
+
* The display parameter hints to the authorization server how the authentication or consent UI should be presented to the user.
|
|
60
|
+
*
|
|
61
|
+
* @category Types (Enums)
|
|
62
|
+
*/
|
|
63
|
+
type DisplayOptions =
|
|
64
|
+
/**
|
|
65
|
+
* Full-page authentication experience in the browser.
|
|
66
|
+
*/
|
|
67
|
+
'page'
|
|
68
|
+
/**
|
|
69
|
+
* Authentication optimized for popup windows.
|
|
70
|
+
*/
|
|
71
|
+
| 'popup'
|
|
72
|
+
/**
|
|
73
|
+
* Authentication optimized for touch-based devices.
|
|
74
|
+
*/
|
|
75
|
+
| 'touch'
|
|
76
|
+
/**
|
|
77
|
+
* Authentication optimized for legacy mobile or constrained browsers.
|
|
78
|
+
*/
|
|
79
|
+
| 'wap';
|
|
80
|
+
/**
|
|
81
|
+
* Supported OAuth 2.0 / OpenID Connect `response_mode` values.
|
|
82
|
+
*
|
|
83
|
+
* The response mode determines how authorization results are returned from the authorization endpoint to the client application.
|
|
84
|
+
*
|
|
85
|
+
* @category Types (Enums)
|
|
86
|
+
*/
|
|
87
|
+
type ResponseModes =
|
|
88
|
+
/**
|
|
89
|
+
* Returns authorization results using an HTTP POST request with parameters encoded in the request body.
|
|
90
|
+
*/
|
|
91
|
+
'form_post'
|
|
92
|
+
/**
|
|
93
|
+
* Returns authorization results as URL query parameters.
|
|
94
|
+
*/
|
|
95
|
+
| 'query'
|
|
96
|
+
/**
|
|
97
|
+
* Returns authorization results in the URL fragment.
|
|
98
|
+
*/
|
|
99
|
+
| 'fragment';
|
|
100
|
+
/**
|
|
101
|
+
* Supported OpenID Connect `prompt` parameter values.
|
|
102
|
+
*
|
|
103
|
+
* The `prompt` parameter controls whether the authorization server should force specific user interactions during authentication.
|
|
104
|
+
*
|
|
105
|
+
* @category Types (Enums)
|
|
106
|
+
*/
|
|
107
|
+
type Prompt =
|
|
108
|
+
/**
|
|
109
|
+
* Do not display any authentication or consent UI.
|
|
110
|
+
*/
|
|
111
|
+
'none'
|
|
112
|
+
/**
|
|
113
|
+
* Forces the user to re-authenticate even if an active session exists.
|
|
114
|
+
*/
|
|
115
|
+
| 'login'
|
|
116
|
+
/**
|
|
117
|
+
* Forces the consent screen to be displayed to the user.
|
|
118
|
+
*/
|
|
119
|
+
| 'consent'
|
|
120
|
+
/**
|
|
121
|
+
* Prompts the user to choose an account when multiple sessions exist.
|
|
122
|
+
*/
|
|
123
|
+
| 'select_account'
|
|
124
|
+
/**
|
|
125
|
+
* Prompts the user to create a new account (sign-up flow).
|
|
126
|
+
*/
|
|
127
|
+
| 'create';
|
|
128
|
+
/**
|
|
129
|
+
* Parameters used to construct an OAuth 2.0 / OpenID Connect authorization request.
|
|
130
|
+
*
|
|
131
|
+
* @category Types
|
|
132
|
+
*/
|
|
133
|
+
interface AuthorizationParams {
|
|
134
|
+
/**
|
|
135
|
+
* A cryptographically random value used to maintain request state
|
|
136
|
+
* and protect against CSRF attacks.
|
|
137
|
+
*/
|
|
138
|
+
state?: string;
|
|
139
|
+
/**
|
|
140
|
+
* Space-separated list of scopes requested during authentication.
|
|
141
|
+
*/
|
|
142
|
+
scopes?: string;
|
|
143
|
+
/**
|
|
144
|
+
* The redirect URI where the authorization server sends the user after authentication completes.
|
|
145
|
+
*/
|
|
146
|
+
redirectUri?: string;
|
|
147
|
+
/**
|
|
148
|
+
* Determines which artifacts are returned from the authorization endpoint.
|
|
149
|
+
*/
|
|
150
|
+
responseType?: ResponseTypes;
|
|
151
|
+
/**
|
|
152
|
+
* PKCE code challenge derived from the code verifier. Used to secure authorization code exchanges.
|
|
153
|
+
*/
|
|
154
|
+
codeChallenge?: string;
|
|
155
|
+
/**
|
|
156
|
+
* Method used to generate the PKCE code challenge.
|
|
157
|
+
*/
|
|
158
|
+
codeChallengeMethod?: CodeChallengeMethod;
|
|
159
|
+
/**
|
|
160
|
+
* Hint to the authorization server indicating which authenticator or connection should be used.
|
|
161
|
+
*/
|
|
162
|
+
authenticatorHint?: Authenticators;
|
|
163
|
+
/**
|
|
164
|
+
* Maximum acceptable time (in seconds) since the user last authenticated. If exceeded, the user may be required to sign in again.
|
|
165
|
+
*/
|
|
166
|
+
maxAge?: number;
|
|
167
|
+
/**
|
|
168
|
+
* Hint identifying the user (for example, email or username). Used to prefill or optimize the sign-in experience.
|
|
169
|
+
*/
|
|
170
|
+
loginHint?: string;
|
|
171
|
+
/**
|
|
172
|
+
* A signed JWT containing authorization request parameters.
|
|
173
|
+
*/
|
|
174
|
+
request?: string;
|
|
175
|
+
/**
|
|
176
|
+
* Specifies how the authorization response is returned to the client.
|
|
177
|
+
*/
|
|
178
|
+
responseMode?: ResponseModes;
|
|
179
|
+
/**
|
|
180
|
+
* Authentication Context Class Reference (ACR) values requesting specific authentication assurance levels or methods.
|
|
181
|
+
*/
|
|
182
|
+
acrValues?: string[];
|
|
183
|
+
/**
|
|
184
|
+
* A cryptographically random value included in the ID token to prevent replay attacks.
|
|
185
|
+
*/
|
|
186
|
+
nonce?: string;
|
|
187
|
+
/**
|
|
188
|
+
* Preferred UI language.
|
|
189
|
+
*/
|
|
190
|
+
uiLocales?: string;
|
|
191
|
+
/**
|
|
192
|
+
* Preferred display mode for the authentication UI.
|
|
193
|
+
*/
|
|
194
|
+
display?: DisplayOptions;
|
|
195
|
+
/**
|
|
196
|
+
* Controls authentication interaction behavior. For example, forcing login or consent.
|
|
197
|
+
*/
|
|
198
|
+
prompt?: Prompt;
|
|
199
|
+
/**
|
|
200
|
+
* URI referencing a previously created authorization request (typically via Pushed Authorization Requests — PAR).
|
|
201
|
+
*
|
|
202
|
+
* When set, other authorization parameters may be ignored.
|
|
203
|
+
*/
|
|
204
|
+
requestUri?: string;
|
|
205
|
+
/**
|
|
206
|
+
* Space-separated list of resource indicators that scope the issued access token.
|
|
207
|
+
*/
|
|
208
|
+
resource?: string;
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* Parameters returned to the application after the authorization server redirects the user back to the callback URL.
|
|
212
|
+
*
|
|
213
|
+
* @category Types
|
|
214
|
+
*/
|
|
215
|
+
interface CallbackParams {
|
|
216
|
+
/**
|
|
217
|
+
* The state value originally sent in the authorization request. Used to validate request integrity and prevent CSRF attacks.
|
|
218
|
+
*/
|
|
219
|
+
state?: string;
|
|
220
|
+
/**
|
|
221
|
+
* Error code returned when authorization fails.
|
|
222
|
+
*/
|
|
223
|
+
error?: string;
|
|
224
|
+
/**
|
|
225
|
+
* Human-readable description providing additional information about the authorization error.
|
|
226
|
+
*/
|
|
227
|
+
errorDescription?: string;
|
|
228
|
+
/**
|
|
229
|
+
* Authorization code returned when using the Authorization Code Flow.
|
|
230
|
+
*/
|
|
231
|
+
code?: string;
|
|
232
|
+
/**
|
|
233
|
+
* Access token returned directly by implicit or hybrid flows.
|
|
234
|
+
*/
|
|
235
|
+
accessToken?: string;
|
|
236
|
+
/**
|
|
237
|
+
* Lifetime of the access token in seconds.
|
|
238
|
+
*/
|
|
239
|
+
expiresIn?: number;
|
|
240
|
+
/**
|
|
241
|
+
* ID token issued by the authorization server.
|
|
242
|
+
*/
|
|
243
|
+
idToken?: string;
|
|
244
|
+
/**
|
|
245
|
+
* Refresh token issued during authorization (if enabled).
|
|
246
|
+
*/
|
|
247
|
+
refreshToken?: string;
|
|
248
|
+
/**
|
|
249
|
+
* OIDC session state value used for session monitoring and front-channel session management.
|
|
250
|
+
*/
|
|
251
|
+
sessionState?: string;
|
|
252
|
+
}
|
|
253
|
+
/**
|
|
254
|
+
* Represents a JSON Web Key (JWK) as defined by RFC 7517.
|
|
255
|
+
*
|
|
256
|
+
* A JWK describes a cryptographic key used to verify or encrypt JSON Web Tokens (JWTs) as obtained from the JWKS (JSON Web Key Set) endpoint exposed by the authorization server.
|
|
257
|
+
*
|
|
258
|
+
* The available properties depend on the key type (`kty`).
|
|
259
|
+
*
|
|
260
|
+
* @category Types
|
|
261
|
+
*/
|
|
262
|
+
interface Jwk {
|
|
263
|
+
/**
|
|
264
|
+
* Key type (for example: `RSA`, or `EC`).
|
|
265
|
+
*/
|
|
266
|
+
kty: string;
|
|
267
|
+
/**
|
|
268
|
+
* Intended algorithm for the key (for example: `RS256`).
|
|
269
|
+
*/
|
|
270
|
+
alg?: string;
|
|
271
|
+
/**
|
|
272
|
+
* Allowed operations for the key (e.g. `sign`, `verify`, `encrypt`).
|
|
273
|
+
*/
|
|
274
|
+
key_ops?: string[];
|
|
275
|
+
/**
|
|
276
|
+
* Indicates whether the key is extractable.
|
|
277
|
+
*/
|
|
278
|
+
ext?: boolean;
|
|
279
|
+
/**
|
|
280
|
+
* Public key use (`sig` for signature or `enc` for encryption).
|
|
281
|
+
*/
|
|
282
|
+
use?: string;
|
|
283
|
+
/**
|
|
284
|
+
* X.509 certificate chain.
|
|
285
|
+
*/
|
|
286
|
+
x5c?: string[];
|
|
287
|
+
/**
|
|
288
|
+
* X.509 certificate SHA-1 thumbprint.
|
|
289
|
+
*/
|
|
290
|
+
x5t?: string;
|
|
291
|
+
/**
|
|
292
|
+
* X.509 certificate SHA-256 thumbprint.
|
|
293
|
+
*/
|
|
294
|
+
'x5t#S256'?: string;
|
|
295
|
+
/**
|
|
296
|
+
* URL referencing the X.509 certificate.
|
|
297
|
+
*/
|
|
298
|
+
x5u?: string;
|
|
299
|
+
/**
|
|
300
|
+
* Key identifier used to match keys during verification.
|
|
301
|
+
*/
|
|
302
|
+
kid?: string;
|
|
303
|
+
/**
|
|
304
|
+
* Elliptic curve name (for example: `P-256`).
|
|
305
|
+
*/
|
|
306
|
+
crv?: string;
|
|
307
|
+
/**
|
|
308
|
+
* X coordinate for EC public keys.
|
|
309
|
+
*/
|
|
310
|
+
x?: string;
|
|
311
|
+
/**
|
|
312
|
+
* Y coordinate for EC public keys.
|
|
313
|
+
*/
|
|
314
|
+
y?: string;
|
|
315
|
+
/**
|
|
316
|
+
* RSA modulus.
|
|
317
|
+
*/
|
|
318
|
+
n?: string;
|
|
319
|
+
/**
|
|
320
|
+
* RSA public exponent.
|
|
321
|
+
*/
|
|
322
|
+
e?: string;
|
|
323
|
+
/**
|
|
324
|
+
* RSA private exponent.
|
|
325
|
+
*/
|
|
326
|
+
d?: string;
|
|
327
|
+
/**
|
|
328
|
+
* RSA first prime factor.
|
|
329
|
+
*/
|
|
330
|
+
p?: string;
|
|
331
|
+
/**
|
|
332
|
+
* RSA second prime factor.
|
|
333
|
+
*/
|
|
334
|
+
q?: string;
|
|
335
|
+
/**
|
|
336
|
+
* RSA first factor CRT exponent.
|
|
337
|
+
*/
|
|
338
|
+
dp?: string;
|
|
339
|
+
/**
|
|
340
|
+
* RSA second factor CRT exponent.
|
|
341
|
+
*/
|
|
342
|
+
dq?: string;
|
|
343
|
+
/**
|
|
344
|
+
* RSA CRT coefficient.
|
|
345
|
+
*/
|
|
346
|
+
qi?: string;
|
|
347
|
+
/**
|
|
348
|
+
* Additional prime information (multi-prime RSA).
|
|
349
|
+
*/
|
|
350
|
+
oth?: {
|
|
351
|
+
d?: string;
|
|
352
|
+
r?: string;
|
|
353
|
+
t?: string;
|
|
354
|
+
}[];
|
|
355
|
+
/**
|
|
356
|
+
* Symmetric key value (base64url encoded).
|
|
357
|
+
*/
|
|
358
|
+
k?: string;
|
|
359
|
+
}
|
|
360
|
+
/**
|
|
361
|
+
* Represents a JSON Web Key Set (JWKS).
|
|
362
|
+
*
|
|
363
|
+
* A JWKS is a collection of public JSON Web Keys used to verify signatures of JSON Web Tokens (JWTs).
|
|
364
|
+
*
|
|
365
|
+
* @category Types
|
|
366
|
+
*/
|
|
367
|
+
interface Jwks {
|
|
368
|
+
/**
|
|
369
|
+
* The list of public keys contained in this key set.
|
|
370
|
+
*/
|
|
371
|
+
keys: Jwk[];
|
|
372
|
+
}
|
|
373
|
+
/**
|
|
374
|
+
* Represents a postal address as defined by the OpenID Connect standard `address` claim.
|
|
375
|
+
*
|
|
376
|
+
* @category Types
|
|
377
|
+
*/
|
|
378
|
+
interface Address {
|
|
379
|
+
/**
|
|
380
|
+
* Full mailing address formatted for display or mailing labels.
|
|
381
|
+
*/
|
|
382
|
+
formatted?: string;
|
|
383
|
+
/**
|
|
384
|
+
* Full street address component, which may include house number, street name, apartment, suite, or unit information.
|
|
385
|
+
*/
|
|
386
|
+
street_address?: string;
|
|
387
|
+
/**
|
|
388
|
+
* City or locality component.
|
|
389
|
+
*/
|
|
390
|
+
locality?: string;
|
|
391
|
+
/**
|
|
392
|
+
* State, province, or region component.
|
|
393
|
+
*/
|
|
394
|
+
region?: string;
|
|
395
|
+
/**
|
|
396
|
+
* Postal or ZIP code.
|
|
397
|
+
*/
|
|
398
|
+
postal_code?: string;
|
|
399
|
+
/**
|
|
400
|
+
* Country name or ISO country code.
|
|
401
|
+
*/
|
|
402
|
+
country?: string;
|
|
403
|
+
/**
|
|
404
|
+
* Additional provider-specific address fields.
|
|
405
|
+
*/
|
|
406
|
+
[key: string]: unknown;
|
|
407
|
+
}
|
|
408
|
+
/**
|
|
409
|
+
* Represents the OpenID Connect **UserInfo** response.
|
|
410
|
+
*
|
|
411
|
+
* @typeParam TAddress - The shape of the `address` claim. Defaults to {@link Address}.
|
|
412
|
+
*
|
|
413
|
+
* @category Types
|
|
414
|
+
*/
|
|
415
|
+
interface UserinfoResponse<TAddress extends Address = Address> {
|
|
416
|
+
/**
|
|
417
|
+
* Subject identifier - a unique, stable identifier for the user within the issuer.
|
|
418
|
+
*/
|
|
419
|
+
sub: string;
|
|
420
|
+
/**
|
|
421
|
+
* Group memberships for the user.
|
|
422
|
+
*/
|
|
423
|
+
groups?: Group[];
|
|
424
|
+
/**
|
|
425
|
+
* Full name of the user (e.g. "Jane Doe").
|
|
426
|
+
*/
|
|
427
|
+
name?: string;
|
|
428
|
+
/**
|
|
429
|
+
* Given name(s) / first name.
|
|
430
|
+
*/
|
|
431
|
+
given_name?: string;
|
|
432
|
+
/**
|
|
433
|
+
* Surname(s) / last name.
|
|
434
|
+
*/
|
|
435
|
+
family_name?: string;
|
|
436
|
+
/**
|
|
437
|
+
* Middle name(s).
|
|
438
|
+
*/
|
|
439
|
+
middle_name?: string;
|
|
440
|
+
/**
|
|
441
|
+
* Casual name used by the user.
|
|
442
|
+
*/
|
|
443
|
+
nickname?: string;
|
|
444
|
+
/**
|
|
445
|
+
* Preferred username.
|
|
446
|
+
*/
|
|
447
|
+
preferred_username?: string;
|
|
448
|
+
/**
|
|
449
|
+
* URL of the user's profile page.
|
|
450
|
+
*/
|
|
451
|
+
profile?: string;
|
|
452
|
+
/**
|
|
453
|
+
* URL of the user's profile picture.
|
|
454
|
+
*/
|
|
455
|
+
picture?: string;
|
|
456
|
+
/**
|
|
457
|
+
* URL of the user's website.
|
|
458
|
+
*/
|
|
459
|
+
website?: string;
|
|
460
|
+
/**
|
|
461
|
+
* Email address.
|
|
462
|
+
*/
|
|
463
|
+
email?: string;
|
|
464
|
+
/**
|
|
465
|
+
* Whether the email address has been verified by the provider.
|
|
466
|
+
*/
|
|
467
|
+
email_verified?: boolean;
|
|
468
|
+
/**
|
|
469
|
+
* Gender.
|
|
470
|
+
*/
|
|
471
|
+
gender?: string;
|
|
472
|
+
/**
|
|
473
|
+
* Birthday.
|
|
474
|
+
*/
|
|
475
|
+
birthdate?: string;
|
|
476
|
+
/**
|
|
477
|
+
* Time zone name.
|
|
478
|
+
*/
|
|
479
|
+
zoneinfo?: string;
|
|
480
|
+
/**
|
|
481
|
+
* Locale.
|
|
482
|
+
*/
|
|
483
|
+
locale?: string;
|
|
484
|
+
/**
|
|
485
|
+
* Phone number (formatted in E.164 standard).
|
|
486
|
+
*/
|
|
487
|
+
phone_number?: string;
|
|
488
|
+
/**
|
|
489
|
+
* Whether the phone number has been verified by the provider.
|
|
490
|
+
*/
|
|
491
|
+
phone_number_verified?: boolean;
|
|
492
|
+
/**
|
|
493
|
+
* Time the user's information was last updated (seconds since epoch).
|
|
494
|
+
*/
|
|
495
|
+
updated_at?: number;
|
|
496
|
+
/**
|
|
497
|
+
* Postal address.
|
|
498
|
+
*/
|
|
499
|
+
address?: TAddress;
|
|
500
|
+
/**
|
|
501
|
+
* Additional provider-specific claims.
|
|
502
|
+
*/
|
|
503
|
+
[key: string]: unknown;
|
|
504
|
+
}
|
|
505
|
+
/**
|
|
506
|
+
* Represents a user group included in the authenticated session.
|
|
507
|
+
*
|
|
508
|
+
* @category Types
|
|
509
|
+
*/
|
|
510
|
+
type Group =
|
|
511
|
+
/**
|
|
512
|
+
* Structured group representation.
|
|
513
|
+
*/
|
|
514
|
+
{
|
|
515
|
+
id: string;
|
|
516
|
+
name: string;
|
|
517
|
+
}
|
|
518
|
+
/**
|
|
519
|
+
* Group identifier or group name.
|
|
520
|
+
*/
|
|
521
|
+
| string;
|
|
522
|
+
/**
|
|
523
|
+
* Represents the authenticated user stored in a MonoCloud session.
|
|
524
|
+
*
|
|
525
|
+
* @category Types
|
|
526
|
+
*/
|
|
527
|
+
interface MonoCloudUser extends UserinfoResponse {
|
|
528
|
+
/**
|
|
529
|
+
* Authentication Methods References (AMR). Indicates how the user authenticated.
|
|
530
|
+
*/
|
|
531
|
+
amr?: string[];
|
|
532
|
+
/**
|
|
533
|
+
* Identity Provider (IdP) identifier. Specifies the upstream provider used to authenticate the user.
|
|
534
|
+
*/
|
|
535
|
+
idp?: string;
|
|
536
|
+
}
|
|
537
|
+
/**
|
|
538
|
+
* Represents an OAuth 2.0 access token and its associated metadata.
|
|
539
|
+
*
|
|
540
|
+
* @category Types
|
|
541
|
+
*/
|
|
542
|
+
interface AccessToken {
|
|
543
|
+
/**
|
|
544
|
+
* The issued access token.
|
|
545
|
+
*/
|
|
546
|
+
accessToken: string;
|
|
547
|
+
/**
|
|
548
|
+
* The expiration time of the access token (Unix epoch, in seconds).
|
|
549
|
+
*/
|
|
550
|
+
accessTokenExpiration: number;
|
|
551
|
+
/**
|
|
552
|
+
* Space-separated list of scopes granted to the access token.
|
|
553
|
+
*
|
|
554
|
+
* These represent the effective permissions approved by the authorization server.
|
|
555
|
+
*/
|
|
556
|
+
scopes: string;
|
|
557
|
+
/**
|
|
558
|
+
* Optional resource (audience) that the access token is scoped for.
|
|
559
|
+
*/
|
|
560
|
+
resource?: string;
|
|
561
|
+
/**
|
|
562
|
+
* Optional space-separated list of scopes originally requested during token acquisition.
|
|
563
|
+
*/
|
|
564
|
+
requestedScopes?: string;
|
|
565
|
+
}
|
|
566
|
+
/**
|
|
567
|
+
* Represents an authenticated session, containing the authenticated user profile along with the tokens and metadata issued during authentication.
|
|
568
|
+
*
|
|
569
|
+
* @category Types
|
|
570
|
+
*/
|
|
571
|
+
interface MonoCloudSession {
|
|
572
|
+
/**
|
|
573
|
+
* The authenticated user profile, typically derived from ID token claims and/or the `UserInfo` endpoint.
|
|
574
|
+
*/
|
|
575
|
+
user: MonoCloudUser;
|
|
576
|
+
/**
|
|
577
|
+
* Optional ID token issued during authentication.
|
|
578
|
+
*/
|
|
579
|
+
idToken?: string;
|
|
580
|
+
/**
|
|
581
|
+
* Space-separated list of scopes authorized for the session.
|
|
582
|
+
*/
|
|
583
|
+
authorizedScopes?: string;
|
|
584
|
+
/**
|
|
585
|
+
* Access tokens associated with the session.
|
|
586
|
+
*
|
|
587
|
+
* Multiple tokens may exist when access tokens are issued for different resources or scope sets.
|
|
588
|
+
*/
|
|
589
|
+
accessTokens?: AccessToken[];
|
|
590
|
+
/**
|
|
591
|
+
* Optional refresh token used to obtain new access tokens without requiring the user to re-authenticate.
|
|
592
|
+
*/
|
|
593
|
+
refreshToken?: string;
|
|
594
|
+
/**
|
|
595
|
+
* Additional custom properties attached to the session.
|
|
596
|
+
*
|
|
597
|
+
* These may be added via hooks such as `onSessionCreating`.
|
|
598
|
+
*/
|
|
599
|
+
[key: string]: unknown;
|
|
600
|
+
}
|
|
601
|
+
/**
|
|
602
|
+
* Standard OpenID Connect ID Token claims.
|
|
603
|
+
*
|
|
604
|
+
* @category Types
|
|
605
|
+
*/
|
|
606
|
+
interface IdTokenClaims extends UserinfoResponse {
|
|
607
|
+
/**
|
|
608
|
+
* Authentication Context Class Reference. Indicates the assurance level of the authentication performed.
|
|
609
|
+
*/
|
|
610
|
+
acr?: string;
|
|
611
|
+
/**
|
|
612
|
+
* Authentication Methods References. Lists the authentication methods used (for example: `pwd`, `mfa`, `otp`).
|
|
613
|
+
*/
|
|
614
|
+
amr?: string[];
|
|
615
|
+
/**
|
|
616
|
+
* Access token hash. Used to validate access tokens returned alongside the ID token.
|
|
617
|
+
*/
|
|
618
|
+
at_hash?: string;
|
|
619
|
+
/**
|
|
620
|
+
* Intended audience(s) of the ID token.
|
|
621
|
+
*/
|
|
622
|
+
aud: string | string[];
|
|
623
|
+
/**
|
|
624
|
+
* Time when the end-user authentication occurred (Unix epoch seconds).
|
|
625
|
+
*/
|
|
626
|
+
auth_time?: number;
|
|
627
|
+
/**
|
|
628
|
+
* Authorized party - identifies the client to which the ID token was issued.
|
|
629
|
+
*/
|
|
630
|
+
azp?: string;
|
|
631
|
+
/**
|
|
632
|
+
* Authorization code hash. Used to validate authorization codes returned with hybrid flows.
|
|
633
|
+
*/
|
|
634
|
+
c_hash?: string;
|
|
635
|
+
/**
|
|
636
|
+
* Expiration time of the ID token (Unix epoch seconds).
|
|
637
|
+
*/
|
|
638
|
+
exp: number;
|
|
639
|
+
/**
|
|
640
|
+
* Time at which the ID token was issued (Unix epoch seconds).
|
|
641
|
+
*/
|
|
642
|
+
iat: number;
|
|
643
|
+
/**
|
|
644
|
+
* Issuer identifier - the authorization server that issued the token.
|
|
645
|
+
*/
|
|
646
|
+
iss: string;
|
|
647
|
+
/**
|
|
648
|
+
* Nonce value used to associate the authentication request with the issued ID token and prevent replay attacks.
|
|
649
|
+
*/
|
|
650
|
+
nonce?: string;
|
|
651
|
+
/**
|
|
652
|
+
* State hash (used in some hybrid flow validations).
|
|
653
|
+
*/
|
|
654
|
+
s_hash?: string;
|
|
655
|
+
/**
|
|
656
|
+
* Subject identifier — uniquely identifies the authenticated user.
|
|
657
|
+
*/
|
|
658
|
+
sub: string;
|
|
659
|
+
/**
|
|
660
|
+
* Additional custom or provider-specific claims.
|
|
661
|
+
*/
|
|
662
|
+
[key: string]: unknown;
|
|
663
|
+
}
|
|
664
|
+
/**
|
|
665
|
+
* OAuth 2.0 / OpenID Connect token endpoint response.
|
|
666
|
+
*
|
|
667
|
+
* @category Types
|
|
668
|
+
*/
|
|
669
|
+
interface Tokens {
|
|
670
|
+
/**
|
|
671
|
+
* Access token issued by the authorization server.
|
|
672
|
+
*/
|
|
673
|
+
access_token: string;
|
|
674
|
+
/**
|
|
675
|
+
* Optional refresh token used to obtain new access tokens without requiring user re-authentication.
|
|
676
|
+
*/
|
|
677
|
+
refresh_token?: string;
|
|
678
|
+
/**
|
|
679
|
+
* Optional ID token containing authentication claims about the user.
|
|
680
|
+
*/
|
|
681
|
+
id_token?: string;
|
|
682
|
+
/**
|
|
683
|
+
* Space-separated list of scopes granted for the access token.
|
|
684
|
+
*/
|
|
685
|
+
scope?: string;
|
|
686
|
+
/**
|
|
687
|
+
* Lifetime of the access token (in seconds) from the time the response was issued.
|
|
688
|
+
*/
|
|
689
|
+
expires_in?: number;
|
|
690
|
+
/**
|
|
691
|
+
* Token type issued.
|
|
692
|
+
*/
|
|
693
|
+
token_type?: string;
|
|
694
|
+
}
|
|
695
|
+
/**
|
|
696
|
+
* Supported authentication methods and identity providers.
|
|
697
|
+
*
|
|
698
|
+
* @category Types (Enums)
|
|
699
|
+
*/
|
|
700
|
+
type Authenticators =
|
|
701
|
+
/**
|
|
702
|
+
* Username/password authentication.
|
|
703
|
+
*/
|
|
704
|
+
'password'
|
|
705
|
+
/**
|
|
706
|
+
* Passkey (WebAuthn / FIDO2) authentication.
|
|
707
|
+
*/
|
|
708
|
+
| 'passkey'
|
|
709
|
+
/**
|
|
710
|
+
* Email-based authentication (magic link or OTP).
|
|
711
|
+
*/
|
|
712
|
+
| 'email'
|
|
713
|
+
/**
|
|
714
|
+
* Phone-based authentication (SMS OTP).
|
|
715
|
+
*/
|
|
716
|
+
| 'phone'
|
|
717
|
+
/**
|
|
718
|
+
* Google identity provider.
|
|
719
|
+
*/
|
|
720
|
+
| 'google'
|
|
721
|
+
/**
|
|
722
|
+
* Apple identity provider.
|
|
723
|
+
*/
|
|
724
|
+
| 'apple'
|
|
725
|
+
/**
|
|
726
|
+
* Facebook identity provider.
|
|
727
|
+
*/
|
|
728
|
+
| 'facebook'
|
|
729
|
+
/**
|
|
730
|
+
* Microsoft identity provider.
|
|
731
|
+
*/
|
|
732
|
+
| 'microsoft'
|
|
733
|
+
/**
|
|
734
|
+
* GitHub identity provider.
|
|
735
|
+
*/
|
|
736
|
+
| 'github'
|
|
737
|
+
/**
|
|
738
|
+
* GitLab identity provider.
|
|
739
|
+
*/
|
|
740
|
+
| 'gitlab'
|
|
741
|
+
/**
|
|
742
|
+
* Discord identity provider.
|
|
743
|
+
*/
|
|
744
|
+
| 'discord'
|
|
745
|
+
/**
|
|
746
|
+
* Twitter (X) identity provider.
|
|
747
|
+
*/
|
|
748
|
+
| 'twitter'
|
|
749
|
+
/**
|
|
750
|
+
* LinkedIn identity provider.
|
|
751
|
+
*/
|
|
752
|
+
| 'linkedin'
|
|
753
|
+
/**
|
|
754
|
+
* Xero identity provider.
|
|
755
|
+
*/
|
|
756
|
+
| 'xero';
|
|
757
|
+
/**
|
|
758
|
+
* Supported JSON Web Signature (JWS) algorithms used to sign tokens.
|
|
759
|
+
*
|
|
760
|
+
* These algorithms define how tokens issued by MonoCloud are cryptographically signed and verified. The expected algorithm should match the configuration of your MonoCloud application.
|
|
761
|
+
*
|
|
762
|
+
* @category Types (Enums)
|
|
763
|
+
*/
|
|
764
|
+
type SecurityAlgorithms =
|
|
765
|
+
/**
|
|
766
|
+
* RSA using SHA-256.
|
|
767
|
+
*
|
|
768
|
+
* Default and most commonly used signing algorithm.
|
|
769
|
+
*/
|
|
770
|
+
'RS256'
|
|
771
|
+
/**
|
|
772
|
+
* RSA using SHA-384.
|
|
773
|
+
*/
|
|
774
|
+
| 'RS384'
|
|
775
|
+
/**
|
|
776
|
+
* RSA using SHA-512.
|
|
777
|
+
*/
|
|
778
|
+
| 'RS512'
|
|
779
|
+
/**
|
|
780
|
+
* RSA-PSS using SHA-256.
|
|
781
|
+
*
|
|
782
|
+
* Provides stronger cryptographic padding than RS256.
|
|
783
|
+
*/
|
|
784
|
+
| 'PS256'
|
|
785
|
+
/**
|
|
786
|
+
* RSA-PSS using SHA-384.
|
|
787
|
+
*/
|
|
788
|
+
| 'PS384'
|
|
789
|
+
/**
|
|
790
|
+
* RSA-PSS using SHA-512.
|
|
791
|
+
*/
|
|
792
|
+
| 'PS512'
|
|
793
|
+
/**
|
|
794
|
+
* ECDSA using P-256 curve and SHA-256.
|
|
795
|
+
*
|
|
796
|
+
* Produces smaller tokens and faster verification.
|
|
797
|
+
*/
|
|
798
|
+
| 'ES256'
|
|
799
|
+
/**
|
|
800
|
+
* ECDSA using P-384 curve and SHA-384.
|
|
801
|
+
*/
|
|
802
|
+
| 'ES384'
|
|
803
|
+
/**
|
|
804
|
+
* ECDSA using P-521 curve and SHA-512.
|
|
805
|
+
*/
|
|
806
|
+
| 'ES512';
|
|
807
|
+
/**
|
|
808
|
+
* Parameters contained in a JSON Web Signature (JWS) header.
|
|
809
|
+
*
|
|
810
|
+
* @category Types
|
|
811
|
+
*/
|
|
812
|
+
interface JwsHeaderParameters {
|
|
813
|
+
/**
|
|
814
|
+
* The cryptographic algorithm used to sign the token.
|
|
815
|
+
*/
|
|
816
|
+
alg: SecurityAlgorithms;
|
|
817
|
+
/**
|
|
818
|
+
* Identifier of the key used to sign the token.
|
|
819
|
+
*/
|
|
820
|
+
kid?: string;
|
|
821
|
+
/**
|
|
822
|
+
* The token type.
|
|
823
|
+
*/
|
|
824
|
+
typ?: string;
|
|
825
|
+
/**
|
|
826
|
+
* List of header parameters that are marked as critical and must be understood by the token processor.
|
|
827
|
+
*/
|
|
828
|
+
crit?: string[];
|
|
829
|
+
/**
|
|
830
|
+
* An embedded JSON Web Key (JWK) containing the signing key.
|
|
831
|
+
*/
|
|
832
|
+
jwk?: Jwk;
|
|
833
|
+
}
|
|
834
|
+
/**
|
|
835
|
+
* Represents the authentication transaction state stored between the authorization request and the callback.
|
|
836
|
+
*
|
|
837
|
+
* @category Types
|
|
838
|
+
*/
|
|
839
|
+
interface AuthState {
|
|
840
|
+
/**
|
|
841
|
+
* A unique value used to correlate the authorization request with the callback and protect against CSRF attacks.
|
|
842
|
+
*/
|
|
843
|
+
state: string;
|
|
844
|
+
/**
|
|
845
|
+
* A cryptographic value used to associate the ID token with the original authentication request and prevent replay attacks.
|
|
846
|
+
*/
|
|
847
|
+
nonce: string;
|
|
848
|
+
/**
|
|
849
|
+
* Optional. PKCE code verifier used to validate the authorization code exchange.
|
|
850
|
+
*/
|
|
851
|
+
codeVerifier?: string;
|
|
852
|
+
/**
|
|
853
|
+
* Optional. Maximum allowed time (in seconds) since the user's last authentication.
|
|
854
|
+
*/
|
|
855
|
+
maxAge?: number;
|
|
856
|
+
/**
|
|
857
|
+
* Optional. Space-separated list of resource indicators requested for the access token.
|
|
858
|
+
*/
|
|
859
|
+
resource?: string;
|
|
860
|
+
/**
|
|
861
|
+
* Space-separated list of scopes requested during authorization.
|
|
862
|
+
*/
|
|
863
|
+
scopes: string;
|
|
864
|
+
}
|
|
865
|
+
/**
|
|
866
|
+
* Parameters used to construct an OpenID Connect end-session (sign-out) request.
|
|
867
|
+
*
|
|
868
|
+
* @category Types
|
|
869
|
+
*/
|
|
870
|
+
interface EndSessionParameters {
|
|
871
|
+
/**
|
|
872
|
+
* ID token hint identifying the session to terminate.
|
|
873
|
+
*
|
|
874
|
+
* When provided, the authorization server can use this value to determine which user session should be signed out.
|
|
875
|
+
*/
|
|
876
|
+
idToken?: string;
|
|
877
|
+
/**
|
|
878
|
+
* The URL the authorization server should redirect the user to after a successful sign-out.
|
|
879
|
+
*/
|
|
880
|
+
postLogoutRedirectUri?: string;
|
|
881
|
+
/**
|
|
882
|
+
* Optional state value returned to the application after sign-out.
|
|
883
|
+
*/
|
|
884
|
+
state?: string;
|
|
885
|
+
}
|
|
886
|
+
/**
|
|
887
|
+
* OpenID Connect Discovery metadata published by the authorization server.
|
|
888
|
+
*
|
|
889
|
+
* @category Types
|
|
890
|
+
*/
|
|
891
|
+
interface IssuerMetadata {
|
|
892
|
+
/**
|
|
893
|
+
* The issuer identifier for the authorization server.
|
|
894
|
+
*/
|
|
895
|
+
issuer: string;
|
|
896
|
+
/**
|
|
897
|
+
* JSON Web Key Set (JWKS) endpoint used to obtain signing keys.
|
|
898
|
+
*/
|
|
899
|
+
jwks_uri: string;
|
|
900
|
+
/**
|
|
901
|
+
* Authorization endpoint used to initiate authentication requests.
|
|
902
|
+
*/
|
|
903
|
+
authorization_endpoint: string;
|
|
904
|
+
/**
|
|
905
|
+
* Token endpoint used to exchange authorization codes for tokens.
|
|
906
|
+
*/
|
|
907
|
+
token_endpoint: string;
|
|
908
|
+
/**
|
|
909
|
+
* UserInfo endpoint used to retrieve user profile claims.
|
|
910
|
+
*/
|
|
911
|
+
userinfo_endpoint: string;
|
|
912
|
+
/**
|
|
913
|
+
* End-session endpoint used to initiate logout.
|
|
914
|
+
*/
|
|
915
|
+
end_session_endpoint: string;
|
|
916
|
+
/**
|
|
917
|
+
* Session management iframe endpoint.
|
|
918
|
+
*/
|
|
919
|
+
check_session_iframe: string;
|
|
920
|
+
/**
|
|
921
|
+
* Token revocation endpoint.
|
|
922
|
+
*/
|
|
923
|
+
revocation_endpoint: string;
|
|
924
|
+
/**
|
|
925
|
+
* Token introspection endpoint.
|
|
926
|
+
*/
|
|
927
|
+
introspection_endpoint: string;
|
|
928
|
+
/**
|
|
929
|
+
* Device Authorization Grant endpoint.
|
|
930
|
+
*/
|
|
931
|
+
device_authorization_endpoint: string;
|
|
932
|
+
/**
|
|
933
|
+
* Pushed Authorization Request (PAR) endpoint.
|
|
934
|
+
*/
|
|
935
|
+
pushed_authorization_request_endpoint?: string;
|
|
936
|
+
/**
|
|
937
|
+
* Indicates support for front-channel logout.
|
|
938
|
+
*/
|
|
939
|
+
frontchannel_logout_supported: boolean;
|
|
940
|
+
/**
|
|
941
|
+
* Indicates front-channel logout session support.
|
|
942
|
+
*/
|
|
943
|
+
frontchannel_logout_session_supported: boolean;
|
|
944
|
+
/**
|
|
945
|
+
* Indicates support for back-channel logout.
|
|
946
|
+
*/
|
|
947
|
+
backchannel_logout_supported: boolean;
|
|
948
|
+
/**
|
|
949
|
+
* Indicates back-channel logout session support.
|
|
950
|
+
*/
|
|
951
|
+
backchannel_logout_session_supported: boolean;
|
|
952
|
+
/**
|
|
953
|
+
* OAuth scopes supported by the authorization server.
|
|
954
|
+
*/
|
|
955
|
+
scopes_supported: string[];
|
|
956
|
+
/**
|
|
957
|
+
* Claims that may be returned in tokens or UserInfo responses.
|
|
958
|
+
*/
|
|
959
|
+
claims_supported: string[];
|
|
960
|
+
/**
|
|
961
|
+
* Supported OAuth grant types.
|
|
962
|
+
*/
|
|
963
|
+
grant_types_supported: string[];
|
|
964
|
+
/**
|
|
965
|
+
* Supported OAuth/OIDC response types.
|
|
966
|
+
*/
|
|
967
|
+
response_types_supported: string[];
|
|
968
|
+
/**
|
|
969
|
+
* Supported response modes.
|
|
970
|
+
*/
|
|
971
|
+
response_modes_supported: string[];
|
|
972
|
+
/**
|
|
973
|
+
* Supported authentication methods for the token endpoint.
|
|
974
|
+
*/
|
|
975
|
+
token_endpoint_auth_methods_supported: string[];
|
|
976
|
+
/**
|
|
977
|
+
* Supported signing algorithms for ID tokens.
|
|
978
|
+
*/
|
|
979
|
+
id_token_signing_alg_values_supported: string[];
|
|
980
|
+
/**
|
|
981
|
+
* Supported subject identifier types.
|
|
982
|
+
*/
|
|
983
|
+
subject_types_supported: string[];
|
|
984
|
+
/**
|
|
985
|
+
* Supported PKCE code challenge methods.
|
|
986
|
+
*/
|
|
987
|
+
code_challenge_methods_supported: string[];
|
|
988
|
+
/**
|
|
989
|
+
* Indicates support for request objects passed by value.
|
|
990
|
+
*/
|
|
991
|
+
request_parameter_supported: boolean;
|
|
992
|
+
/**
|
|
993
|
+
* Indicates support for request objects passed by reference (request_uri).
|
|
994
|
+
*/
|
|
995
|
+
request_uri_parameter_supported: boolean;
|
|
996
|
+
/**
|
|
997
|
+
* Indicates whether PAR is required for authorization requests.
|
|
998
|
+
*/
|
|
999
|
+
require_pushed_authorization_requests: boolean;
|
|
1000
|
+
/**
|
|
1001
|
+
* Supported signing algorithms for request objects.
|
|
1002
|
+
*/
|
|
1003
|
+
request_object_signing_alg_values_supported: string[];
|
|
1004
|
+
}
|
|
1005
|
+
/**
|
|
1006
|
+
* Options used when exchanging a refresh token for a new access token.
|
|
1007
|
+
*
|
|
1008
|
+
* These parameters allow requesting an access token scoped to specific resources or scopes that were previously authorized by the user.
|
|
1009
|
+
*
|
|
1010
|
+
* @category Types
|
|
1011
|
+
*/
|
|
1012
|
+
interface RefreshGrantOptions {
|
|
1013
|
+
/**
|
|
1014
|
+
* Space-separated list of resource indicators that the new access token should be issued for.
|
|
1015
|
+
*
|
|
1016
|
+
* The requested resources must have been previously granted during the original authorization flow.
|
|
1017
|
+
*/
|
|
1018
|
+
resource?: string;
|
|
1019
|
+
/**
|
|
1020
|
+
* Space-separated list of scopes to request for the refreshed access token.
|
|
1021
|
+
*
|
|
1022
|
+
* The requested scopes must have been granted during the original authorization flow.
|
|
1023
|
+
*/
|
|
1024
|
+
scopes?: string;
|
|
1025
|
+
}
|
|
1026
|
+
/**
|
|
1027
|
+
* Options used when authenticating a user via the Authorization Code flow.
|
|
1028
|
+
*
|
|
1029
|
+
* @category Types
|
|
1030
|
+
*/
|
|
1031
|
+
interface AuthenticateOptions {
|
|
1032
|
+
/**
|
|
1033
|
+
* PKCE code verifier associated with the authorization request.
|
|
1034
|
+
*/
|
|
1035
|
+
codeVerifier?: string;
|
|
1036
|
+
/**
|
|
1037
|
+
* When enabled, user profile data is fetched from the UserInfo endpoint and merged into the session user object.
|
|
1038
|
+
* @defaultValue false
|
|
1039
|
+
*/
|
|
1040
|
+
fetchUserInfo?: boolean;
|
|
1041
|
+
/**
|
|
1042
|
+
* Determines whether the ID token signature and claims should be validated. Disabling validation is not recommended except for advanced or controlled environments.
|
|
1043
|
+
* @defaultValue true
|
|
1044
|
+
*/
|
|
1045
|
+
validateIdToken?: boolean;
|
|
1046
|
+
/**
|
|
1047
|
+
* JSON Web Key Set used to validate the ID token signature.
|
|
1048
|
+
*
|
|
1049
|
+
* If not provided, the JWKS is automatically fetched from the authorization server metadata.
|
|
1050
|
+
*/
|
|
1051
|
+
jwks?: Jwks;
|
|
1052
|
+
/**
|
|
1053
|
+
* Nonce value expected in the ID token. Used to prevent replay attacks.
|
|
1054
|
+
*/
|
|
1055
|
+
idTokenNonce?: string;
|
|
1056
|
+
/**
|
|
1057
|
+
* Maximum allowed authentication age (in seconds) for the ID token.
|
|
1058
|
+
*/
|
|
1059
|
+
idTokenMaxAge?: number;
|
|
1060
|
+
/**
|
|
1061
|
+
* Clock skew adjustment (in seconds) applied when validating ID token timestamps against the authorization server.
|
|
1062
|
+
*/
|
|
1063
|
+
idTokenClockSkew?: number;
|
|
1064
|
+
/**
|
|
1065
|
+
* Additional allowed clock tolerance (in seconds) when validating time-based ID token claims such as `exp`, `iat`, and `nbf`.
|
|
1066
|
+
*/
|
|
1067
|
+
idTokenClockTolerance?: number;
|
|
1068
|
+
/**
|
|
1069
|
+
* List of ID token claims to remove before storing the session.
|
|
1070
|
+
*/
|
|
1071
|
+
filteredIdTokenClaims?: string[];
|
|
1072
|
+
/**
|
|
1073
|
+
* Callback invoked before a session is created or updated. Allows customization or enrichment of the session.
|
|
1074
|
+
*/
|
|
1075
|
+
onSessionCreating?: OnSessionCreating;
|
|
1076
|
+
}
|
|
1077
|
+
/**
|
|
1078
|
+
* Options used when refreshing an existing MonoCloud session.
|
|
1079
|
+
*
|
|
1080
|
+
* @category Types
|
|
1081
|
+
*/
|
|
1082
|
+
interface RefreshSessionOptions {
|
|
1083
|
+
/**
|
|
1084
|
+
* When enabled, user profile data is fetched from the UserInfo endpoint and merged into the session user object.
|
|
1085
|
+
* @defaultValue false
|
|
1086
|
+
*/
|
|
1087
|
+
fetchUserInfo?: boolean;
|
|
1088
|
+
/**
|
|
1089
|
+
* Determines whether the ID token signature and claims should be validated. Disabling validation is not recommended except for advanced or controlled environments.
|
|
1090
|
+
* @defaultValue true
|
|
1091
|
+
*/
|
|
1092
|
+
validateIdToken?: boolean;
|
|
1093
|
+
/**
|
|
1094
|
+
* JSON Web Key Set used to validate the ID token signature.
|
|
1095
|
+
*
|
|
1096
|
+
* If not provided, the JWKS is automatically fetched from the authorization server metadata.
|
|
1097
|
+
*/
|
|
1098
|
+
jwks?: Jwks;
|
|
1099
|
+
/**
|
|
1100
|
+
* Clock skew adjustment (in seconds) applied when validating ID token timestamps against the authorization server.
|
|
1101
|
+
*/
|
|
1102
|
+
idTokenClockSkew?: number;
|
|
1103
|
+
/**
|
|
1104
|
+
* Additional allowed clock tolerance (in seconds) when validating time-based ID token claims such as `exp`, `iat`, and `nbf`.
|
|
1105
|
+
*/
|
|
1106
|
+
idTokenClockTolerance?: number;
|
|
1107
|
+
/**
|
|
1108
|
+
* Options applied to the refresh token grant request, such as requesting tokens for specific resources or scopes.
|
|
1109
|
+
*/
|
|
1110
|
+
refreshGrantOptions?: RefreshGrantOptions;
|
|
1111
|
+
/**
|
|
1112
|
+
* List of ID token claims to remove before storing the session.
|
|
1113
|
+
*/
|
|
1114
|
+
filteredIdTokenClaims?: string[];
|
|
1115
|
+
/**
|
|
1116
|
+
* Callback invoked before a session is created or updated. Allows customization or enrichment of the session.
|
|
1117
|
+
*/
|
|
1118
|
+
onSessionCreating?: OnSessionCreating;
|
|
1119
|
+
}
|
|
1120
|
+
/**
|
|
1121
|
+
* Options used when refetching user profile data from the UserInfo endpoint.
|
|
1122
|
+
*
|
|
1123
|
+
* @category Types
|
|
1124
|
+
*/
|
|
1125
|
+
interface RefetchUserInfoOptions {
|
|
1126
|
+
/**
|
|
1127
|
+
* Callback invoked before a session is created or updated. Allows customization or enrichment of the session.
|
|
1128
|
+
*/
|
|
1129
|
+
onSessionCreating?: OnSessionCreating;
|
|
1130
|
+
}
|
|
1131
|
+
/**
|
|
1132
|
+
* Supported OAuth 2.0 client authentication methods.
|
|
1133
|
+
*
|
|
1134
|
+
* These methods define how a client authenticates itself when calling the authorization server token endpoint.
|
|
1135
|
+
*
|
|
1136
|
+
* @category Types (Enums)
|
|
1137
|
+
*/
|
|
1138
|
+
type ClientAuthMethod =
|
|
1139
|
+
/**
|
|
1140
|
+
* Client credentials are sent using HTTP Basic authentication
|
|
1141
|
+
*/
|
|
1142
|
+
'client_secret_basic'
|
|
1143
|
+
/**
|
|
1144
|
+
* Client credentials are included in the request body as form parameters.
|
|
1145
|
+
*/
|
|
1146
|
+
| 'client_secret_post'
|
|
1147
|
+
/**
|
|
1148
|
+
* Client authenticates using a signed JWT created with the client secret.
|
|
1149
|
+
*/
|
|
1150
|
+
| 'client_secret_jwt'
|
|
1151
|
+
/**
|
|
1152
|
+
* Client authenticates using a signed JWT created with a private key.
|
|
1153
|
+
*/
|
|
1154
|
+
| 'private_key_jwt';
|
|
1155
|
+
/**
|
|
1156
|
+
* Parameters used when creating a Pushed Authorization Request (PAR).
|
|
1157
|
+
*
|
|
1158
|
+
* This type mirrors {@link AuthorizationParams} but excludes `requestUri`,
|
|
1159
|
+
* since the `request_uri` value is generated by the authorization server
|
|
1160
|
+
* after a successful PAR request and must not be supplied by the client.
|
|
1161
|
+
*
|
|
1162
|
+
* @category Types
|
|
1163
|
+
*/
|
|
1164
|
+
interface PushedAuthorizationParams extends Omit<AuthorizationParams, 'requestUri'> {}
|
|
1165
|
+
/**
|
|
1166
|
+
* Configuration options used to initialize the MonoCloudClient.
|
|
1167
|
+
*
|
|
1168
|
+
* @category Types
|
|
1169
|
+
*/
|
|
1170
|
+
interface MonoCloudClientOptions {
|
|
1171
|
+
/**
|
|
1172
|
+
* Client secret used for client authentication.
|
|
1173
|
+
*
|
|
1174
|
+
* When `clientAuthMethod` is `client_secret_jwt` and a plain-text secret is provided, the default signing algorithm is `HS256`.
|
|
1175
|
+
*
|
|
1176
|
+
* To use a different algorithm, provide a symmetric JSON Web Key (JWK) (`kty: "oct"`) with the desired algorithm specified in its `alg` property.
|
|
1177
|
+
*/
|
|
1178
|
+
clientSecret?: string | Jwk;
|
|
1179
|
+
/**
|
|
1180
|
+
* Client authentication method used when communicating with the token endpoint.
|
|
1181
|
+
*/
|
|
1182
|
+
clientAuthMethod?: ClientAuthMethod;
|
|
1183
|
+
/**
|
|
1184
|
+
* Expected signing algorithm for validating ID tokens.
|
|
1185
|
+
* @defaultValue 'RS256'
|
|
1186
|
+
*/
|
|
1187
|
+
idTokenSigningAlgorithm?: SecurityAlgorithms;
|
|
1188
|
+
/**
|
|
1189
|
+
* Duration (in seconds) to cache the JSON Web Key Set (JWKS) retrieved from the authorization server.
|
|
1190
|
+
* @defaultValue 300
|
|
1191
|
+
*/
|
|
1192
|
+
jwksCacheDuration?: number;
|
|
1193
|
+
/**
|
|
1194
|
+
* Duration (in seconds) to cache OpenID Connect discovery metadata.
|
|
1195
|
+
* @defaultValue 300
|
|
1196
|
+
*/
|
|
1197
|
+
metadataCacheDuration?: number;
|
|
1198
|
+
}
|
|
1199
|
+
/**
|
|
1200
|
+
* Response returned from the Pushed Authorization Request (PAR) endpoint.
|
|
1201
|
+
*
|
|
1202
|
+
* @category Types
|
|
1203
|
+
*/
|
|
1204
|
+
interface ParResponse {
|
|
1205
|
+
/**
|
|
1206
|
+
* The URI reference identifying the pushed authorization request.
|
|
1207
|
+
*
|
|
1208
|
+
* This value must be supplied as the `request_uri` parameter when redirecting the user to the authorization endpoint.
|
|
1209
|
+
*/
|
|
1210
|
+
request_uri: string;
|
|
1211
|
+
/**
|
|
1212
|
+
* Lifetime of the `request_uri`, in seconds. After this duration expires, the authorization request becomes invalid.
|
|
1213
|
+
*/
|
|
1214
|
+
expires_in: number;
|
|
1215
|
+
}
|
|
1216
|
+
/**
|
|
1217
|
+
* Callback invoked before a session is created or updated.
|
|
1218
|
+
*
|
|
1219
|
+
* This hook allows you to inspect or modify the session during the authentication lifecycle — for example, to enrich the session with custom claims, normalize user data, or apply application-specific logic.
|
|
1220
|
+
*
|
|
1221
|
+
* @category Types (Handler)
|
|
1222
|
+
*
|
|
1223
|
+
* @param session - The session being created or updated.
|
|
1224
|
+
* @param idToken - Optional. Claims extracted from the ID token.
|
|
1225
|
+
* @param userInfo - Optional. Claims returned from the `UserInfo` endpoint.
|
|
1226
|
+
* @returns Returns a promise or void. Execution continues once the callback completes.
|
|
1227
|
+
*/
|
|
1228
|
+
type OnSessionCreating = (
|
|
1229
|
+
/**
|
|
1230
|
+
* The session being created or updated.
|
|
1231
|
+
*/
|
|
1232
|
+
session: MonoCloudSession,
|
|
1233
|
+
/**
|
|
1234
|
+
* Optional. Claims extracted from the ID token received during authentication.
|
|
1235
|
+
*/
|
|
1236
|
+
idToken?: Partial<IdTokenClaims>,
|
|
1237
|
+
/**
|
|
1238
|
+
* Optional. Claims returned from the UserInfo endpoint.
|
|
1239
|
+
*/
|
|
1240
|
+
userInfo?: UserinfoResponse) => Promise<void> | void;
|
|
1241
|
+
//#endregion
|
|
1242
|
+
export { SecurityAlgorithms as A, Prompt as C, RefreshSessionOptions as D, RefreshGrantOptions as E, UserinfoResponse as M, ResponseModes as O, ParResponse as S, RefetchUserInfoOptions as T, JwsHeaderParameters as _, Authenticators as a, MonoCloudUser as b, ClientAuthMethod as c, EndSessionParameters as d, Group as f, Jwks as g, Jwk as h, AuthenticateOptions as i, Tokens as j, ResponseTypes as k, CodeChallengeMethod as l, IssuerMetadata as m, Address as n, AuthorizationParams as o, IdTokenClaims as p, AuthState as r, CallbackParams as s, AccessToken as t, DisplayOptions as u, MonoCloudClientOptions as v, PushedAuthorizationParams as w, OnSessionCreating as x, MonoCloudSession as y };
|
|
1243
|
+
//# sourceMappingURL=types-hokU85Zr.d.mts.map
|