@crossauth/sveltekit 0.0.20 → 0.0.22
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.cjs +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +863 -849
- package/dist/sveltekitadminclientendpoints.d.ts +16 -17
- package/dist/sveltekitadminendpoints.d.ts +20 -21
- package/dist/sveltekitapikey.d.ts +3 -3
- package/dist/sveltekitoauthclient.d.ts +13 -14
- package/dist/sveltekitoauthserver.d.ts +14 -14
- package/dist/sveltekitresserver.d.ts +4 -5
- package/dist/sveltekitserver.d.ts +8 -8
- package/dist/sveltekitsession.d.ts +20 -5
- package/dist/sveltekitsessionadapter.d.ts +3 -2
- package/dist/sveltekitsharedclientendpoints.d.ts +7 -8
- package/dist/sveltekituserclientendpoints.d.ts +16 -17
- package/dist/sveltekituserendpoints.d.ts +36 -37
- package/dist/tests/sveltekitoauthclient.test.d.ts +6 -6
- package/dist/tests/sveltekitoauthresserver.test.d.ts +5 -5
- package/dist/tests/sveltemocks.d.ts +3 -2
- package/dist/tests/testshared.d.ts +8 -8
- package/dist/utils.d.ts +2 -1
- package/package.json +4 -4
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { SvelteKitSessionServer } from './sveltekitsession';
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
import type { SearchClientsPageData, UpdateClientPageData, UpdateClientFormData, DeleteClientPageData, DeleteClientFormData } from './sveltekitsharedclientendpoints';
|
|
1
|
+
import { SvelteKitSessionServer, SvelteKitSessionServerOptions } from './sveltekitsession';
|
|
2
|
+
import { RequestEvent } from '@sveltejs/kit';
|
|
3
|
+
import { SvelteKitSharedClientEndpoints, SearchClientsPageData, UpdateClientPageData, UpdateClientFormData, DeleteClientPageData, DeleteClientFormData } from './sveltekitsharedclientendpoints';
|
|
4
|
+
|
|
6
5
|
/**
|
|
7
6
|
* Endpoints for manipulating the OAuth client table, for use by admins.
|
|
8
7
|
*
|
|
@@ -73,7 +72,7 @@ export declare class SvelteKitAdminClientEndpoints extends SvelteKitSharedClient
|
|
|
73
72
|
readonly searchClientsEndpoint: {
|
|
74
73
|
load: (event: RequestEvent) => Promise<{
|
|
75
74
|
ok: boolean;
|
|
76
|
-
clients?: import(
|
|
75
|
+
clients?: import('@crossauth/common').OAuthClient[] | undefined;
|
|
77
76
|
skip: number;
|
|
78
77
|
take: number;
|
|
79
78
|
search?: string | undefined;
|
|
@@ -83,8 +82,8 @@ export declare class SvelteKitAdminClientEndpoints extends SvelteKitSharedClient
|
|
|
83
82
|
hasPrevious: boolean;
|
|
84
83
|
hasNext: boolean;
|
|
85
84
|
clientUserId?: string | number | undefined;
|
|
86
|
-
user:
|
|
87
|
-
csrfToken:
|
|
85
|
+
user: import('@crossauth/common').User | undefined;
|
|
86
|
+
csrfToken: string | undefined;
|
|
88
87
|
}>;
|
|
89
88
|
};
|
|
90
89
|
/**
|
|
@@ -93,7 +92,7 @@ export declare class SvelteKitAdminClientEndpoints extends SvelteKitSharedClient
|
|
|
93
92
|
readonly updateClientEndpoint: {
|
|
94
93
|
load: (event: RequestEvent) => Promise<{
|
|
95
94
|
ok: boolean;
|
|
96
|
-
client?: import(
|
|
95
|
+
client?: import('@crossauth/common').OAuthClient | undefined;
|
|
97
96
|
client_id?: string | undefined;
|
|
98
97
|
clientUsername?: string | undefined;
|
|
99
98
|
error?: string | undefined;
|
|
@@ -103,8 +102,8 @@ export declare class SvelteKitAdminClientEndpoints extends SvelteKitSharedClient
|
|
|
103
102
|
valid_flowNames: {
|
|
104
103
|
[key: string]: string;
|
|
105
104
|
};
|
|
106
|
-
user:
|
|
107
|
-
csrfToken:
|
|
105
|
+
user: import('@crossauth/common').User | undefined;
|
|
106
|
+
csrfToken: string | undefined;
|
|
108
107
|
}>;
|
|
109
108
|
actions: {
|
|
110
109
|
default: (event: RequestEvent) => Promise<UpdateClientFormData>;
|
|
@@ -116,7 +115,7 @@ export declare class SvelteKitAdminClientEndpoints extends SvelteKitSharedClient
|
|
|
116
115
|
readonly createClientEndpoint: {
|
|
117
116
|
load: (event: RequestEvent) => Promise<{
|
|
118
117
|
ok: boolean;
|
|
119
|
-
client?: import(
|
|
118
|
+
client?: import('@crossauth/common').OAuthClient | undefined;
|
|
120
119
|
client_id?: string | undefined;
|
|
121
120
|
clientUsername?: string | undefined;
|
|
122
121
|
error?: string | undefined;
|
|
@@ -126,8 +125,8 @@ export declare class SvelteKitAdminClientEndpoints extends SvelteKitSharedClient
|
|
|
126
125
|
valid_flowNames: {
|
|
127
126
|
[key: string]: string;
|
|
128
127
|
};
|
|
129
|
-
user:
|
|
130
|
-
csrfToken:
|
|
128
|
+
user: import('@crossauth/common').User | undefined;
|
|
129
|
+
csrfToken: string | undefined;
|
|
131
130
|
}>;
|
|
132
131
|
actions: {
|
|
133
132
|
default: (event: RequestEvent) => Promise<UpdateClientFormData>;
|
|
@@ -139,14 +138,14 @@ export declare class SvelteKitAdminClientEndpoints extends SvelteKitSharedClient
|
|
|
139
138
|
readonly deleteClientEndpoint: {
|
|
140
139
|
load: (event: RequestEvent) => Promise<{
|
|
141
140
|
ok: boolean;
|
|
142
|
-
client?: import(
|
|
141
|
+
client?: import('@crossauth/common').OAuthClient | undefined;
|
|
143
142
|
client_id?: string | undefined;
|
|
144
143
|
clientUsername?: string | undefined;
|
|
145
144
|
error?: string | undefined;
|
|
146
145
|
errorCode?: number | undefined;
|
|
147
146
|
errorCodeName?: string | undefined;
|
|
148
|
-
user:
|
|
149
|
-
csrfToken:
|
|
147
|
+
user: import('@crossauth/common').User | undefined;
|
|
148
|
+
csrfToken: string | undefined;
|
|
150
149
|
}>;
|
|
151
150
|
actions: {
|
|
152
151
|
default: (event: RequestEvent) => Promise<DeleteClientFormData>;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { SvelteKitSessionServer } from './sveltekitsession';
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
import type { RequestEvent } from '@sveltejs/kit';
|
|
1
|
+
import { SvelteKitSessionServer, SvelteKitSessionServerOptions } from './sveltekitsession';
|
|
2
|
+
import { User, UserInputFields, ErrorCode } from '@crossauth/common';
|
|
3
|
+
import { RequestEvent } from '@sveltejs/kit';
|
|
4
|
+
|
|
6
5
|
/**
|
|
7
6
|
* Return type for {@link SvelteKitAdminEndpoints.updateUser}
|
|
8
7
|
* {@link SvelteKitAdminEndpoints.updateUserEndpoint} action.
|
|
@@ -295,8 +294,8 @@ export declare class SvelteKitAdminEndpoints {
|
|
|
295
294
|
*/
|
|
296
295
|
deleteUser(event: RequestEvent): Promise<AdminDeleteUserReturn>;
|
|
297
296
|
baseEndpoint(event: RequestEvent): {
|
|
298
|
-
user:
|
|
299
|
-
csrfToken:
|
|
297
|
+
user: User | undefined;
|
|
298
|
+
csrfToken: string | undefined;
|
|
300
299
|
};
|
|
301
300
|
readonly searchUsersEndpoint: {
|
|
302
301
|
load: (event: RequestEvent) => Promise<{
|
|
@@ -310,8 +309,8 @@ export declare class SvelteKitAdminEndpoints {
|
|
|
310
309
|
errorCodeName?: string | undefined;
|
|
311
310
|
hasPrevious: boolean;
|
|
312
311
|
hasNext: boolean;
|
|
313
|
-
user:
|
|
314
|
-
csrfToken:
|
|
312
|
+
user: User | undefined;
|
|
313
|
+
csrfToken: string | undefined;
|
|
315
314
|
}>;
|
|
316
315
|
};
|
|
317
316
|
private getUserFromParam;
|
|
@@ -320,8 +319,8 @@ export declare class SvelteKitAdminEndpoints {
|
|
|
320
319
|
default: (event: RequestEvent) => Promise<AdminUpdateUserReturn>;
|
|
321
320
|
};
|
|
322
321
|
load: (event: RequestEvent) => Promise<{
|
|
323
|
-
user:
|
|
324
|
-
csrfToken:
|
|
322
|
+
user: User | undefined;
|
|
323
|
+
csrfToken: string | undefined;
|
|
325
324
|
allowedFactor2: {
|
|
326
325
|
name: string;
|
|
327
326
|
friendlyName: string;
|
|
@@ -335,20 +334,20 @@ export declare class SvelteKitAdminEndpoints {
|
|
|
335
334
|
default: (event: RequestEvent) => Promise<AdminChangePasswordReturn>;
|
|
336
335
|
};
|
|
337
336
|
load: (event: RequestEvent) => Promise<{
|
|
338
|
-
user:
|
|
339
|
-
csrfToken:
|
|
337
|
+
user: User | undefined;
|
|
338
|
+
csrfToken: string | undefined;
|
|
340
339
|
editUser: User | undefined;
|
|
341
340
|
} | {
|
|
342
|
-
user:
|
|
343
|
-
csrfToken:
|
|
341
|
+
user: User | undefined;
|
|
342
|
+
csrfToken: string | undefined;
|
|
344
343
|
editUser: User;
|
|
345
344
|
next?: string | undefined;
|
|
346
345
|
}>;
|
|
347
346
|
};
|
|
348
347
|
readonly createUserEndpoint: {
|
|
349
348
|
load: (event: RequestEvent) => Promise<{
|
|
350
|
-
user:
|
|
351
|
-
csrfToken:
|
|
349
|
+
user: User | undefined;
|
|
350
|
+
csrfToken: string | undefined;
|
|
352
351
|
allowedFactor2: {
|
|
353
352
|
name: string;
|
|
354
353
|
friendlyName: string;
|
|
@@ -364,14 +363,14 @@ export declare class SvelteKitAdminEndpoints {
|
|
|
364
363
|
default: (event: RequestEvent) => Promise<AdminDeleteUserReturn>;
|
|
365
364
|
};
|
|
366
365
|
load: (event: RequestEvent) => Promise<{
|
|
367
|
-
user:
|
|
368
|
-
csrfToken:
|
|
366
|
+
user: User | undefined;
|
|
367
|
+
csrfToken: string | undefined;
|
|
369
368
|
error: string;
|
|
370
369
|
errorCode: ErrorCode | undefined;
|
|
371
370
|
errorCodeName: string | undefined;
|
|
372
371
|
} | {
|
|
373
|
-
user:
|
|
374
|
-
csrfToken:
|
|
372
|
+
user: User | undefined;
|
|
373
|
+
csrfToken: string | undefined;
|
|
375
374
|
username: string;
|
|
376
375
|
}>;
|
|
377
376
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { UserStorage, KeyStorage } from '@crossauth/backend';
|
|
2
|
-
import
|
|
3
|
-
|
|
1
|
+
import { UserStorage, KeyStorage, ApiKeyManagerOptions } from '@crossauth/backend';
|
|
2
|
+
import { RequestEvent, MaybePromise } from '@sveltejs/kit';
|
|
3
|
+
|
|
4
4
|
/**
|
|
5
5
|
* Options for {@link SvelteKitApiKeyServer }.
|
|
6
6
|
*
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { CrossauthError, ErrorCode } from '@crossauth/common';
|
|
2
|
-
import
|
|
3
|
-
import { OAuthClientBackend } from '@crossauth/backend';
|
|
4
|
-
import type { OAuthClientOptions } from '@crossauth/backend';
|
|
1
|
+
import { CrossauthError, ErrorCode, OAuthTokenResponse, OAuthDeviceAuthorizationResponse, User } from '@crossauth/common';
|
|
2
|
+
import { OAuthClientBackend, OAuthClientOptions } from '@crossauth/backend';
|
|
5
3
|
import { SvelteKitServer } from './sveltekitserver';
|
|
6
|
-
import
|
|
4
|
+
import { RequestEvent, MaybePromise } from '@sveltejs/kit';
|
|
5
|
+
|
|
7
6
|
export type SvelteKitErrorFn = (server: SvelteKitServer, event: RequestEvent, ce: CrossauthError) => Promise<Response>;
|
|
8
7
|
/**
|
|
9
8
|
* Options for {@link SvelteKitOAuthClient}.
|
|
@@ -403,7 +402,7 @@ export declare class SvelteKitOAuthClient extends OAuthClientBackend {
|
|
|
403
402
|
}>;
|
|
404
403
|
pack(ret: {
|
|
405
404
|
[key: string]: any;
|
|
406
|
-
} | undefined | Response):
|
|
405
|
+
} | undefined | Response): Response;
|
|
407
406
|
/**
|
|
408
407
|
* Ordinarily you would not call this directly but use `allBffEndpoint`.
|
|
409
408
|
*
|
|
@@ -432,7 +431,7 @@ export declare class SvelteKitOAuthClient extends OAuthClientBackend {
|
|
|
432
431
|
load: (event: RequestEvent) => Promise<AuthorizationCodeFlowReturn>;
|
|
433
432
|
};
|
|
434
433
|
readonly authorizationCodeFlowWithPKCEEndpoint: {
|
|
435
|
-
get: (event: RequestEvent) => Promise<
|
|
434
|
+
get: (event: RequestEvent) => Promise<Response>;
|
|
436
435
|
load: (event: RequestEvent) => Promise<AuthorizationCodeFlowReturn>;
|
|
437
436
|
};
|
|
438
437
|
readonly redirectUriEndpoint: {
|
|
@@ -440,7 +439,7 @@ export declare class SvelteKitOAuthClient extends OAuthClientBackend {
|
|
|
440
439
|
load: (event: RequestEvent) => Promise<RedirectUriReturn>;
|
|
441
440
|
};
|
|
442
441
|
readonly clientCredentialsFlowEndpoint: {
|
|
443
|
-
post: (event: RequestEvent) => Promise<
|
|
442
|
+
post: (event: RequestEvent) => Promise<Response>;
|
|
444
443
|
actions: {
|
|
445
444
|
default: (event: RequestEvent) => Promise<{}>;
|
|
446
445
|
};
|
|
@@ -452,7 +451,7 @@ export declare class SvelteKitOAuthClient extends OAuthClientBackend {
|
|
|
452
451
|
};
|
|
453
452
|
};
|
|
454
453
|
readonly refreshTokensIfExpiredEndpoint: {
|
|
455
|
-
post: (event: RequestEvent) => Promise<
|
|
454
|
+
post: (event: RequestEvent) => Promise<Response>;
|
|
456
455
|
actions: {
|
|
457
456
|
default: (event: RequestEvent) => Promise<Response | (TokenReturn & {
|
|
458
457
|
expires_at?: number | undefined;
|
|
@@ -460,10 +459,10 @@ export declare class SvelteKitOAuthClient extends OAuthClientBackend {
|
|
|
460
459
|
};
|
|
461
460
|
};
|
|
462
461
|
readonly autoRefreshTokensIfExpiredEndpoint: {
|
|
463
|
-
post: (event: RequestEvent) => Promise<
|
|
462
|
+
post: (event: RequestEvent) => Promise<Response>;
|
|
464
463
|
};
|
|
465
464
|
readonly autoRefreshTokensEndpoint: {
|
|
466
|
-
post: (event: RequestEvent) => Promise<
|
|
465
|
+
post: (event: RequestEvent) => Promise<Response>;
|
|
467
466
|
};
|
|
468
467
|
readonly startDeviceCodeFlowEndpoint: {
|
|
469
468
|
actions: {
|
|
@@ -471,13 +470,13 @@ export declare class SvelteKitOAuthClient extends OAuthClientBackend {
|
|
|
471
470
|
verification_uri_qrdata?: string | undefined;
|
|
472
471
|
}>;
|
|
473
472
|
};
|
|
474
|
-
post: (event: RequestEvent) => Promise<
|
|
473
|
+
post: (event: RequestEvent) => Promise<Response>;
|
|
475
474
|
};
|
|
476
475
|
readonly pollDeviceCodeFlowEndpoint: {
|
|
477
476
|
actions: {
|
|
478
477
|
default: (event: RequestEvent) => Promise<{}>;
|
|
479
478
|
};
|
|
480
|
-
post: (event: RequestEvent) => Promise<
|
|
479
|
+
post: (event: RequestEvent) => Promise<Response>;
|
|
481
480
|
};
|
|
482
481
|
readonly passwordFlowEndpoint: {
|
|
483
482
|
post: (event: RequestEvent) => Promise<Response | {
|
|
@@ -578,7 +577,7 @@ export declare class SvelteKitOAuthClient extends OAuthClientBackend {
|
|
|
578
577
|
};
|
|
579
578
|
};
|
|
580
579
|
readonly deleteTokensEndpoint: {
|
|
581
|
-
post: (event: RequestEvent) => Promise<
|
|
580
|
+
post: (event: RequestEvent) => Promise<Response>;
|
|
582
581
|
actions: {
|
|
583
582
|
default: (event: RequestEvent) => Promise<{
|
|
584
583
|
ok: boolean;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { OAuthClientStorage, KeyStorage, OAuthAuthorizationServer, Authenticator } from '@crossauth/backend';
|
|
2
|
-
import type { OAuthAuthorizationServerOptions, DoubleSubmitCsrfTokenOptions } from '@crossauth/backend';
|
|
1
|
+
import { OAuthClientStorage, KeyStorage, OAuthAuthorizationServer, Authenticator, OAuthAuthorizationServerOptions, DoubleSubmitCsrfTokenOptions } from '@crossauth/backend';
|
|
3
2
|
import { SvelteKitServer } from './sveltekitserver';
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
3
|
+
import { OpenIdConfiguration, User } from '@crossauth/common';
|
|
4
|
+
import { RequestEvent } from '@sveltejs/kit';
|
|
5
|
+
|
|
6
6
|
/**
|
|
7
7
|
* Query parameters for the `authorize` request.
|
|
8
8
|
*/
|
|
@@ -313,8 +313,8 @@ export declare class SvelteKitAuthorizationServer {
|
|
|
313
313
|
* - `csrfToken` the CSRF token from `event.locals.csrfToken`
|
|
314
314
|
*/
|
|
315
315
|
baseEndpoint(event: RequestEvent): {
|
|
316
|
-
user:
|
|
317
|
-
csrfToken:
|
|
316
|
+
user: User | undefined;
|
|
317
|
+
csrfToken: string | undefined;
|
|
318
318
|
};
|
|
319
319
|
/**
|
|
320
320
|
* `get` function for the oidcConfiguration endpoint.
|
|
@@ -322,7 +322,7 @@ export declare class SvelteKitAuthorizationServer {
|
|
|
322
322
|
* See class description for details.
|
|
323
323
|
*/
|
|
324
324
|
readonly oidcConfigurationEndpoint: {
|
|
325
|
-
get: (_event: RequestEvent) => Promise<
|
|
325
|
+
get: (_event: RequestEvent) => Promise<Response>;
|
|
326
326
|
};
|
|
327
327
|
/**
|
|
328
328
|
* `get` function for the jwks endpoint.
|
|
@@ -330,7 +330,7 @@ export declare class SvelteKitAuthorizationServer {
|
|
|
330
330
|
* See class description for details.
|
|
331
331
|
*/
|
|
332
332
|
readonly jwksGetEndpoint: {
|
|
333
|
-
get: (_event: RequestEvent) => Promise<
|
|
333
|
+
get: (_event: RequestEvent) => Promise<Response>;
|
|
334
334
|
};
|
|
335
335
|
/**
|
|
336
336
|
* `get` function for the csrfToken endpoint.
|
|
@@ -339,7 +339,7 @@ export declare class SvelteKitAuthorizationServer {
|
|
|
339
339
|
* protection to rely on Sveltekit's.
|
|
340
340
|
*/
|
|
341
341
|
readonly getCsrfTokenEndpoint: {
|
|
342
|
-
get: (event: RequestEvent) => Promise<
|
|
342
|
+
get: (event: RequestEvent) => Promise<Response>;
|
|
343
343
|
};
|
|
344
344
|
/**
|
|
345
345
|
* `load` and `actions` functions for the authorize endpoint.
|
|
@@ -360,7 +360,7 @@ export declare class SvelteKitAuthorizationServer {
|
|
|
360
360
|
* protection to rely on Sveltekit's.
|
|
361
361
|
*/
|
|
362
362
|
readonly tokenEndpoint: {
|
|
363
|
-
post: (event: RequestEvent) => Promise<
|
|
363
|
+
post: (event: RequestEvent) => Promise<Response>;
|
|
364
364
|
};
|
|
365
365
|
/**
|
|
366
366
|
* `get` and `post` functions for the mfa/authenticators endpoint.
|
|
@@ -369,8 +369,8 @@ export declare class SvelteKitAuthorizationServer {
|
|
|
369
369
|
* protection to rely on Sveltekit's.
|
|
370
370
|
*/
|
|
371
371
|
readonly mfaAuthenticatorsEndpoint: {
|
|
372
|
-
get: (event: RequestEvent) => Promise<
|
|
373
|
-
post: (event: RequestEvent) => Promise<
|
|
372
|
+
get: (event: RequestEvent) => Promise<Response>;
|
|
373
|
+
post: (event: RequestEvent) => Promise<Response>;
|
|
374
374
|
};
|
|
375
375
|
/**
|
|
376
376
|
* `post` function for the mfa/challenge endpoint.
|
|
@@ -379,7 +379,7 @@ export declare class SvelteKitAuthorizationServer {
|
|
|
379
379
|
* protection to rely on Sveltekit's.
|
|
380
380
|
*/
|
|
381
381
|
readonly mfaChallengeEndpoint: {
|
|
382
|
-
post: (event: RequestEvent) => Promise<
|
|
382
|
+
post: (event: RequestEvent) => Promise<Response>;
|
|
383
383
|
};
|
|
384
384
|
/**
|
|
385
385
|
* `post` function for the device_authorization endpoint.
|
|
@@ -388,7 +388,7 @@ export declare class SvelteKitAuthorizationServer {
|
|
|
388
388
|
* protection to rely on Sveltekit's.
|
|
389
389
|
*/
|
|
390
390
|
readonly deviceAuthorizationEndpoint: {
|
|
391
|
-
post: (event: RequestEvent) => Promise<
|
|
391
|
+
post: (event: RequestEvent) => Promise<Response>;
|
|
392
392
|
};
|
|
393
393
|
/**
|
|
394
394
|
* `load` and `actions` functions for the authorize endpoint.
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import { OAuthResourceServer, UserStorage } from '@crossauth/backend';
|
|
4
|
-
import type { OAuthResourceServerOptions } from '@crossauth/backend';
|
|
5
|
-
import { OAuthTokenConsumer } from '@crossauth/backend';
|
|
1
|
+
import { RequestEvent, MaybePromise } from '@sveltejs/kit';
|
|
2
|
+
import { User } from '@crossauth/common';
|
|
3
|
+
import { OAuthResourceServer, UserStorage, OAuthResourceServerOptions, OAuthTokenConsumer } from '@crossauth/backend';
|
|
6
4
|
import { SvelteKitSessionAdapter } from './sveltekitsessionadapter';
|
|
5
|
+
|
|
7
6
|
/**
|
|
8
7
|
* Options for {@link SvelteKitOAuthResourceServer}
|
|
9
8
|
*/
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { SvelteKitSessionServer,
|
|
2
|
-
import { SvelteKitApiKeyServer,
|
|
3
|
-
import { SvelteKitAuthorizationServer,
|
|
1
|
+
import { SvelteKitSessionServer, SvelteKitSessionServerOptions } from './sveltekitsession';
|
|
2
|
+
import { SvelteKitApiKeyServer, SvelteKitApiKeyServerOptions } from './sveltekitapikey';
|
|
3
|
+
import { SvelteKitAuthorizationServer, SvelteKitAuthorizationServerOptions } from './sveltekitoauthserver';
|
|
4
4
|
import { UserStorage, KeyStorage, OAuthClientStorage } from '@crossauth/backend';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { SvelteKitOAuthClient } from './sveltekitoauthclient';
|
|
8
|
-
import
|
|
9
|
-
import { SvelteKitOAuthResourceServer, type SvelteKitOAuthResourceServerOptions } from './sveltekitresserver';
|
|
5
|
+
import { User } from '@crossauth/common';
|
|
6
|
+
import { Handle, RequestEvent, ResolveOptions, MaybePromise } from '@sveltejs/kit';
|
|
7
|
+
import { SvelteKitOAuthClient, SvelteKitOAuthClientOptions } from './sveltekitoauthclient';
|
|
8
|
+
import { SvelteKitOAuthResourceServer, SvelteKitOAuthResourceServerOptions } from './sveltekitresserver';
|
|
10
9
|
import { SvelteKitSessionAdapter } from './sveltekitsessionadapter';
|
|
10
|
+
|
|
11
11
|
export interface SvelteKitServerOptions extends SvelteKitSessionServerOptions, SvelteKitApiKeyServerOptions, SvelteKitAuthorizationServerOptions, SvelteKitOAuthClientOptions, SvelteKitOAuthResourceServerOptions {
|
|
12
12
|
/** User can set this to check if the user is an administrator.
|
|
13
13
|
* By default, the admin booloean field in the user object is checked
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { KeyStorage, UserStorage, OAuthClientStorage, SessionManager, Authenticator } from '@crossauth/backend';
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import type { RequestEvent, MaybePromise } from '@sveltejs/kit';
|
|
1
|
+
import { KeyStorage, UserStorage, OAuthClientStorage, SessionManager, Authenticator, Cookie, SessionManagerOptions } from '@crossauth/backend';
|
|
2
|
+
import { Key, User, UserInputFields, OAuthClient } from '@crossauth/common';
|
|
3
|
+
import { RequestEvent, MaybePromise } from '@sveltejs/kit';
|
|
5
4
|
import { SvelteKitUserEndpoints } from './sveltekituserendpoints';
|
|
6
5
|
import { SvelteKitAdminEndpoints } from './sveltekitadminendpoints';
|
|
7
6
|
import { SvelteKitUserClientEndpoints } from './sveltekituserclientendpoints';
|
|
8
7
|
import { SvelteKitAdminClientEndpoints } from './sveltekitadminclientendpoints';
|
|
9
8
|
import { SvelteKitSessionAdapter } from './sveltekitsessionadapter';
|
|
9
|
+
|
|
10
10
|
export declare const CSRFHEADER = "X-CROSSAUTH-CSRF";
|
|
11
11
|
export type Header = {
|
|
12
12
|
name: string;
|
|
@@ -166,6 +166,19 @@ export interface SvelteKitSessionServerOptions extends SessionManagerOptions {
|
|
|
166
166
|
* The default is empty
|
|
167
167
|
*/
|
|
168
168
|
loginProtectedExceptionApiEndpoints?: string[];
|
|
169
|
+
/**
|
|
170
|
+
* This overrides `adminProtectedPageEndpoints`
|
|
171
|
+
*
|
|
172
|
+
* The default is empty.
|
|
173
|
+
*
|
|
174
|
+
*/
|
|
175
|
+
adminProtectedExceptionPageEndpoints?: string[];
|
|
176
|
+
/**
|
|
177
|
+
* This overrides `adminProtectedPageEndpoints`
|
|
178
|
+
*
|
|
179
|
+
* The default is empty
|
|
180
|
+
*/
|
|
181
|
+
adminProtectedExceptionApiEndpoints?: string[];
|
|
169
182
|
/**
|
|
170
183
|
* See `adminPageEndpoints`
|
|
171
184
|
*/
|
|
@@ -373,6 +386,8 @@ export declare class SvelteKitSessionServer implements SvelteKitSessionAdapter {
|
|
|
373
386
|
private loginProtectedExceptionApiEndpoints;
|
|
374
387
|
private adminPageEndpoints;
|
|
375
388
|
private adminApiEndpoints;
|
|
389
|
+
private adminProtectedExceptionPageEndpoints;
|
|
390
|
+
private adminProtectedExceptionApiEndpoints;
|
|
376
391
|
readonly unauthorizedUrl: string | undefined;
|
|
377
392
|
readonly enableCsrfProtection = true;
|
|
378
393
|
/** Whether email verification is enabled.
|
|
@@ -514,7 +529,7 @@ export declare class SvelteKitSessionServer implements SvelteKitSessionAdapter {
|
|
|
514
529
|
*/
|
|
515
530
|
static updateRequest(event: RequestEvent, params: {
|
|
516
531
|
[key: string]: string;
|
|
517
|
-
}, contentType: string): RequestEvent
|
|
532
|
+
}, contentType: string): RequestEvent<Partial<Record<string, string>>, string | null>;
|
|
518
533
|
/**
|
|
519
534
|
* Returns a hash of the session ID. Used for logging (for security,
|
|
520
535
|
* the actual session ID is not logged)
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import { RequestEvent } from '@sveltejs/kit';
|
|
2
|
+
import { User } from '@crossauth/common';
|
|
3
|
+
|
|
3
4
|
export declare abstract class SvelteKitSessionAdapter {
|
|
4
5
|
abstract csrfProtectionEnabled(): boolean;
|
|
5
6
|
abstract getCsrfToken(event: RequestEvent): string | undefined;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { SvelteKitSessionServer } from './sveltekitsession';
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
import type { RequestEvent } from '@sveltejs/kit';
|
|
1
|
+
import { SvelteKitSessionServer, SvelteKitSessionServerOptions } from './sveltekitsession';
|
|
2
|
+
import { OAuthClientManager, OAuthClientStorage } from '@crossauth/backend';
|
|
3
|
+
import { OAuthClient } from '@crossauth/common';
|
|
4
|
+
import { RequestEvent } from '@sveltejs/kit';
|
|
5
|
+
|
|
7
6
|
/**
|
|
8
7
|
* Return type for {@link SvelteKitUserClientEndpoints.searchClients}
|
|
9
8
|
* {@link SvelteKitAdminClientEndpoints.searchClients} load.
|
|
@@ -291,7 +290,7 @@ export declare class SvelteKitSharedClientEndpoints {
|
|
|
291
290
|
* - `csrfToken` the CSRF token if using
|
|
292
291
|
*/
|
|
293
292
|
baseEndpoint(event: RequestEvent): {
|
|
294
|
-
user:
|
|
295
|
-
csrfToken:
|
|
293
|
+
user: import('@crossauth/common').User | undefined;
|
|
294
|
+
csrfToken: string | undefined;
|
|
296
295
|
};
|
|
297
296
|
}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { SvelteKitSessionServer } from './sveltekitsession';
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
import { SvelteKitSharedClientEndpoints } from './sveltekitsharedclientendpoints';
|
|
1
|
+
import { SvelteKitSessionServer, SvelteKitSessionServerOptions } from './sveltekitsession';
|
|
2
|
+
import { RequestEvent } from '@sveltejs/kit';
|
|
3
|
+
import { SearchClientsPageData, UpdateClientPageData, UpdateClientFormData, DeleteClientPageData, DeleteClientFormData, SvelteKitSharedClientEndpoints } from './sveltekitsharedclientendpoints';
|
|
4
|
+
|
|
6
5
|
/**
|
|
7
6
|
* Endpoints for manipulating the OAuth client table, for use by users.
|
|
8
7
|
*
|
|
@@ -73,7 +72,7 @@ export declare class SvelteKitUserClientEndpoints extends SvelteKitSharedClientE
|
|
|
73
72
|
readonly searchClientsEndpoint: {
|
|
74
73
|
load: (event: RequestEvent) => Promise<{
|
|
75
74
|
ok: boolean;
|
|
76
|
-
clients?: import(
|
|
75
|
+
clients?: import('@crossauth/common').OAuthClient[] | undefined;
|
|
77
76
|
skip: number;
|
|
78
77
|
take: number;
|
|
79
78
|
search?: string | undefined;
|
|
@@ -83,8 +82,8 @@ export declare class SvelteKitUserClientEndpoints extends SvelteKitSharedClientE
|
|
|
83
82
|
hasPrevious: boolean;
|
|
84
83
|
hasNext: boolean;
|
|
85
84
|
clientUserId?: string | number | undefined;
|
|
86
|
-
user:
|
|
87
|
-
csrfToken:
|
|
85
|
+
user: import('@crossauth/common').User | undefined;
|
|
86
|
+
csrfToken: string | undefined;
|
|
88
87
|
}>;
|
|
89
88
|
};
|
|
90
89
|
/**
|
|
@@ -93,7 +92,7 @@ export declare class SvelteKitUserClientEndpoints extends SvelteKitSharedClientE
|
|
|
93
92
|
readonly updateClientEndpoint: {
|
|
94
93
|
load: (event: RequestEvent) => Promise<{
|
|
95
94
|
ok: boolean;
|
|
96
|
-
client?: import(
|
|
95
|
+
client?: import('@crossauth/common').OAuthClient | undefined;
|
|
97
96
|
client_id?: string | undefined;
|
|
98
97
|
clientUsername?: string | undefined;
|
|
99
98
|
error?: string | undefined;
|
|
@@ -103,8 +102,8 @@ export declare class SvelteKitUserClientEndpoints extends SvelteKitSharedClientE
|
|
|
103
102
|
valid_flowNames: {
|
|
104
103
|
[key: string]: string;
|
|
105
104
|
};
|
|
106
|
-
user:
|
|
107
|
-
csrfToken:
|
|
105
|
+
user: import('@crossauth/common').User | undefined;
|
|
106
|
+
csrfToken: string | undefined;
|
|
108
107
|
}>;
|
|
109
108
|
actions: {
|
|
110
109
|
default: (event: RequestEvent) => Promise<UpdateClientFormData>;
|
|
@@ -116,7 +115,7 @@ export declare class SvelteKitUserClientEndpoints extends SvelteKitSharedClientE
|
|
|
116
115
|
readonly createClientEndpoint: {
|
|
117
116
|
load: (event: RequestEvent) => Promise<{
|
|
118
117
|
ok: boolean;
|
|
119
|
-
client?: import(
|
|
118
|
+
client?: import('@crossauth/common').OAuthClient | undefined;
|
|
120
119
|
client_id?: string | undefined;
|
|
121
120
|
clientUsername?: string | undefined;
|
|
122
121
|
error?: string | undefined;
|
|
@@ -126,8 +125,8 @@ export declare class SvelteKitUserClientEndpoints extends SvelteKitSharedClientE
|
|
|
126
125
|
valid_flowNames: {
|
|
127
126
|
[key: string]: string;
|
|
128
127
|
};
|
|
129
|
-
user:
|
|
130
|
-
csrfToken:
|
|
128
|
+
user: import('@crossauth/common').User | undefined;
|
|
129
|
+
csrfToken: string | undefined;
|
|
131
130
|
}>;
|
|
132
131
|
actions: {
|
|
133
132
|
default: (event: RequestEvent) => Promise<UpdateClientFormData>;
|
|
@@ -139,14 +138,14 @@ export declare class SvelteKitUserClientEndpoints extends SvelteKitSharedClientE
|
|
|
139
138
|
readonly deleteClientEndpoint: {
|
|
140
139
|
load: (event: RequestEvent) => Promise<{
|
|
141
140
|
ok: boolean;
|
|
142
|
-
client?: import(
|
|
141
|
+
client?: import('@crossauth/common').OAuthClient | undefined;
|
|
143
142
|
client_id?: string | undefined;
|
|
144
143
|
clientUsername?: string | undefined;
|
|
145
144
|
error?: string | undefined;
|
|
146
145
|
errorCode?: number | undefined;
|
|
147
146
|
errorCodeName?: string | undefined;
|
|
148
|
-
user:
|
|
149
|
-
csrfToken:
|
|
147
|
+
user: import('@crossauth/common').User | undefined;
|
|
148
|
+
csrfToken: string | undefined;
|
|
150
149
|
}>;
|
|
151
150
|
actions: {
|
|
152
151
|
default: (event: RequestEvent) => Promise<DeleteClientFormData>;
|