@frontmcp/auth 0.10.0 → 0.11.0
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/__test-utils__/assertion.helpers.d.ts +2 -0
- package/__test-utils__/assertion.helpers.d.ts.map +1 -0
- package/authorization/authorization.class.d.ts +122 -0
- package/authorization/authorization.class.d.ts.map +1 -0
- package/authorization/authorization.types.d.ts +65 -1
- package/authorization/authorization.types.d.ts.map +1 -1
- package/authorization/index.d.ts +11 -2
- package/authorization/index.d.ts.map +1 -1
- package/authorization/orchestrated.accessor.d.ts +161 -0
- package/authorization/orchestrated.accessor.d.ts.map +1 -0
- package/authorization/orchestrated.authorization.d.ts +257 -0
- package/authorization/orchestrated.authorization.d.ts.map +1 -0
- package/authorization/public.authorization.d.ts +92 -0
- package/authorization/public.authorization.d.ts.map +1 -0
- package/authorization/transparent.authorization.d.ts +130 -0
- package/authorization/transparent.authorization.d.ts.map +1 -0
- package/common/auth-logger.interface.d.ts +15 -0
- package/common/auth-logger.interface.d.ts.map +1 -0
- package/common/index.d.ts +6 -0
- package/common/index.d.ts.map +1 -0
- package/common/jwt.types.d.ts +87 -0
- package/common/jwt.types.d.ts.map +1 -0
- package/common/session-user.types.d.ts +17 -0
- package/common/session-user.types.d.ts.map +1 -0
- package/common/session.types.d.ts +190 -0
- package/common/session.types.d.ts.map +1 -0
- package/common/zod-utils.d.ts +5 -0
- package/common/zod-utils.d.ts.map +1 -0
- package/consent/consent.types.d.ts +112 -0
- package/consent/consent.types.d.ts.map +1 -0
- package/consent/index.d.ts +2 -0
- package/consent/index.d.ts.map +1 -0
- package/detection/auth-provider-detection.d.ts +53 -0
- package/detection/auth-provider-detection.d.ts.map +1 -0
- package/detection/index.d.ts +3 -0
- package/detection/index.d.ts.map +1 -0
- package/errors/auth-internal.error.d.ts +33 -0
- package/errors/auth-internal.error.d.ts.map +1 -0
- package/errors/auth-internal.errors.d.ts +123 -0
- package/errors/auth-internal.errors.d.ts.map +1 -0
- package/errors/index.d.ts +3 -0
- package/errors/index.d.ts.map +1 -0
- package/esm/index.mjs +5473 -1204
- package/esm/package.json +18 -3
- package/index.d.ts +18 -5
- package/index.d.ts.map +1 -1
- package/index.js +5351 -961
- package/jwks/jwks.service.d.ts +1 -0
- package/jwks/jwks.service.d.ts.map +1 -1
- package/jwks/jwks.types.d.ts +3 -0
- package/jwks/jwks.types.d.ts.map +1 -1
- package/machine-id/index.d.ts +2 -0
- package/machine-id/index.d.ts.map +1 -0
- package/machine-id/machine-id.d.ts +28 -0
- package/machine-id/machine-id.d.ts.map +1 -0
- package/options/app-auth.schema.d.ts +272 -0
- package/options/app-auth.schema.d.ts.map +1 -0
- package/options/index.d.ts +15 -0
- package/options/index.d.ts.map +1 -0
- package/options/interfaces.d.ts +250 -0
- package/options/interfaces.d.ts.map +1 -0
- package/options/orchestrated.schema.d.ts +446 -0
- package/options/orchestrated.schema.d.ts.map +1 -0
- package/options/public.schema.d.ts +19 -0
- package/options/public.schema.d.ts.map +1 -0
- package/options/schema.d.ts +265 -0
- package/options/schema.d.ts.map +1 -0
- package/options/shared.schemas.d.ts +128 -0
- package/options/shared.schemas.d.ts.map +1 -0
- package/options/transparent.schema.d.ts +33 -0
- package/options/transparent.schema.d.ts.map +1 -0
- package/options/typecheck.d.ts +2 -0
- package/options/typecheck.d.ts.map +1 -0
- package/options/utils.d.ts +33 -0
- package/options/utils.d.ts.map +1 -0
- package/package.json +18 -3
- package/session/encrypted-authorization-vault.d.ts +182 -0
- package/session/encrypted-authorization-vault.d.ts.map +1 -0
- package/session/federated-auth.session.d.ts +252 -0
- package/session/federated-auth.session.d.ts.map +1 -0
- package/session/index.d.ts +21 -1
- package/session/index.d.ts.map +1 -1
- package/session/orchestrated-token.store.d.ts +155 -0
- package/session/orchestrated-token.store.d.ts.map +1 -0
- package/session/redis-session.store.d.ts +93 -0
- package/session/redis-session.store.d.ts.map +1 -0
- package/session/session-crypto.d.ts +84 -0
- package/session/session-crypto.d.ts.map +1 -0
- package/session/session-rate-limiter.d.ts +114 -0
- package/session/session-rate-limiter.d.ts.map +1 -0
- package/session/session.transport.d.ts +11 -0
- package/session/session.transport.d.ts.map +1 -0
- package/session/session.types.d.ts +66 -0
- package/session/session.types.d.ts.map +1 -0
- package/session/token.refresh.d.ts +61 -0
- package/session/token.refresh.d.ts.map +1 -0
- package/session/transport-session.types.d.ts +479 -0
- package/session/transport-session.types.d.ts.map +1 -0
- package/session/utils/auth-token.utils.d.ts +12 -0
- package/session/utils/auth-token.utils.d.ts.map +1 -0
- package/session/utils/index.d.ts +2 -0
- package/session/utils/index.d.ts.map +1 -1
- package/session/utils/session-crypto.utils.d.ts +30 -0
- package/session/utils/session-crypto.utils.d.ts.map +1 -0
- package/session/vercel-kv-session.store.d.ts +123 -0
- package/session/vercel-kv-session.store.d.ts.map +1 -0
- package/utils/authorization-id.utils.d.ts +12 -0
- package/utils/authorization-id.utils.d.ts.map +1 -0
- package/utils/index.d.ts +1 -0
- package/utils/index.d.ts.map +1 -1
- package/vault/auth-providers.accessor.d.ts +154 -0
- package/vault/auth-providers.accessor.d.ts.map +1 -0
- package/vault/auth-providers.accessor.impl.d.ts +54 -0
- package/vault/auth-providers.accessor.impl.d.ts.map +1 -0
- package/vault/auth-providers.registry.d.ts +111 -0
- package/vault/auth-providers.registry.d.ts.map +1 -0
- package/vault/auth-providers.types.d.ts +3 -3
- package/vault/auth-providers.vault.d.ts +94 -0
- package/vault/auth-providers.vault.d.ts.map +1 -0
- package/vault/credential-loaders/eager-loader.d.ts +47 -0
- package/vault/credential-loaders/eager-loader.d.ts.map +1 -0
- package/vault/credential-loaders/index.d.ts +7 -0
- package/vault/credential-loaders/index.d.ts.map +1 -0
- package/vault/credential-loaders/lazy-loader.d.ts +54 -0
- package/vault/credential-loaders/lazy-loader.d.ts.map +1 -0
- package/vault/index.d.ts +9 -0
- package/vault/index.d.ts.map +1 -1
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
import { AuthorizationBase } from './authorization.class';
|
|
2
|
+
import type { AuthorizationCreateCtx, AuthUser, AuthMode } from './authorization.types';
|
|
3
|
+
import type { EncryptedBlob } from '@frontmcp/utils';
|
|
4
|
+
/**
|
|
5
|
+
* Token store interface for orchestrated mode
|
|
6
|
+
* Implementations can be memory-based, Redis, or custom stores
|
|
7
|
+
*/
|
|
8
|
+
export interface TokenStore {
|
|
9
|
+
/**
|
|
10
|
+
* Retrieve decrypted access token for a provider
|
|
11
|
+
*/
|
|
12
|
+
getAccessToken(authorizationId: string, providerId: string): Promise<string | null>;
|
|
13
|
+
/**
|
|
14
|
+
* Retrieve decrypted refresh token for a provider
|
|
15
|
+
*/
|
|
16
|
+
getRefreshToken(authorizationId: string, providerId: string): Promise<string | null>;
|
|
17
|
+
/**
|
|
18
|
+
* Store tokens for a provider (encrypted)
|
|
19
|
+
*/
|
|
20
|
+
storeTokens(authorizationId: string, providerId: string, tokens: {
|
|
21
|
+
accessToken: string;
|
|
22
|
+
refreshToken?: string;
|
|
23
|
+
expiresAt?: number;
|
|
24
|
+
}): Promise<void>;
|
|
25
|
+
/**
|
|
26
|
+
* Delete tokens for a provider
|
|
27
|
+
*/
|
|
28
|
+
deleteTokens(authorizationId: string, providerId: string): Promise<void>;
|
|
29
|
+
/**
|
|
30
|
+
* Check if tokens exist for a provider
|
|
31
|
+
*/
|
|
32
|
+
hasTokens(authorizationId: string, providerId: string): Promise<boolean>;
|
|
33
|
+
/**
|
|
34
|
+
* Get all provider IDs that have tokens stored for this authorization.
|
|
35
|
+
*/
|
|
36
|
+
getProviderIds(authorizationId: string): Promise<string[]>;
|
|
37
|
+
/**
|
|
38
|
+
* Migrate tokens from one authorization ID to another.
|
|
39
|
+
* Used when tokens are stored with a pending ID during federated auth
|
|
40
|
+
* and need to be accessible under the real authorization ID.
|
|
41
|
+
*
|
|
42
|
+
* @param fromAuthId - Source authorization ID (e.g., "pending:abc123")
|
|
43
|
+
* @param toAuthId - Target authorization ID (e.g., "def456")
|
|
44
|
+
*/
|
|
45
|
+
migrateTokens(fromAuthId: string, toAuthId: string): Promise<void>;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Token refresh callback type
|
|
49
|
+
*/
|
|
50
|
+
export type TokenRefreshCallback = (providerId: string, refreshToken: string) => Promise<{
|
|
51
|
+
accessToken: string;
|
|
52
|
+
refreshToken?: string;
|
|
53
|
+
expiresIn?: number;
|
|
54
|
+
}>;
|
|
55
|
+
/**
|
|
56
|
+
* Provider token state for orchestrated authorization
|
|
57
|
+
*/
|
|
58
|
+
export interface OrchestratedProviderState {
|
|
59
|
+
/** Provider ID */
|
|
60
|
+
id: string;
|
|
61
|
+
/** Encrypted access token blob */
|
|
62
|
+
accessTokenEnc?: EncryptedBlob;
|
|
63
|
+
/** Encrypted refresh token blob */
|
|
64
|
+
refreshTokenEnc?: EncryptedBlob;
|
|
65
|
+
/** Token expiration (epoch ms) */
|
|
66
|
+
expiresAt?: number;
|
|
67
|
+
/** External reference ID (for vault/store) */
|
|
68
|
+
secretRefId?: string;
|
|
69
|
+
/** Refresh reference ID */
|
|
70
|
+
refreshRefId?: string;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Context for creating an OrchestratedAuthorization
|
|
74
|
+
*/
|
|
75
|
+
export interface OrchestratedAuthorizationCreateCtx {
|
|
76
|
+
/**
|
|
77
|
+
* The local JWT issued by the orchestrating server
|
|
78
|
+
*/
|
|
79
|
+
token: string;
|
|
80
|
+
/**
|
|
81
|
+
* User identity from upstream provider
|
|
82
|
+
*/
|
|
83
|
+
user: AuthUser;
|
|
84
|
+
/**
|
|
85
|
+
* Scopes granted to this authorization
|
|
86
|
+
*/
|
|
87
|
+
scopes?: string[];
|
|
88
|
+
/**
|
|
89
|
+
* JWT claims
|
|
90
|
+
*/
|
|
91
|
+
claims?: Record<string, unknown>;
|
|
92
|
+
/**
|
|
93
|
+
* Expiration (epoch ms)
|
|
94
|
+
*/
|
|
95
|
+
expiresAt?: number;
|
|
96
|
+
/**
|
|
97
|
+
* Primary provider ID (default for getToken)
|
|
98
|
+
*/
|
|
99
|
+
primaryProviderId?: string;
|
|
100
|
+
/**
|
|
101
|
+
* Token store for retrieving/storing provider tokens
|
|
102
|
+
*/
|
|
103
|
+
tokenStore?: TokenStore;
|
|
104
|
+
/**
|
|
105
|
+
* Token refresh callback
|
|
106
|
+
*/
|
|
107
|
+
onTokenRefresh?: TokenRefreshCallback;
|
|
108
|
+
/**
|
|
109
|
+
* Provider states (with encrypted tokens)
|
|
110
|
+
*/
|
|
111
|
+
providers?: Record<string, OrchestratedProviderState>;
|
|
112
|
+
/**
|
|
113
|
+
* Precomputed authorization projections
|
|
114
|
+
*/
|
|
115
|
+
authorizedTools?: AuthorizationCreateCtx['authorizedTools'];
|
|
116
|
+
authorizedToolIds?: string[];
|
|
117
|
+
authorizedPrompts?: AuthorizationCreateCtx['authorizedPrompts'];
|
|
118
|
+
authorizedPromptIds?: string[];
|
|
119
|
+
authorizedApps?: AuthorizationCreateCtx['authorizedApps'];
|
|
120
|
+
authorizedAppIds?: string[];
|
|
121
|
+
authorizedResources?: string[];
|
|
122
|
+
/**
|
|
123
|
+
* Provider IDs that the user has explicitly authorized during federated login.
|
|
124
|
+
* Populated from JWT claims (`federated.selectedProviders`) or token store.
|
|
125
|
+
* Controls which providers the authorization has access to for progressive auth.
|
|
126
|
+
*/
|
|
127
|
+
authorizedProviderIds?: string[];
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* OrchestratedAuthorization - Local auth server with secure token storage
|
|
131
|
+
*
|
|
132
|
+
* In orchestrated mode:
|
|
133
|
+
* - The MCP server acts as an OAuth client to upstream providers
|
|
134
|
+
* - Provider tokens are encrypted and never exposed to the LLM
|
|
135
|
+
* - Supports token refresh and multi-provider scenarios
|
|
136
|
+
* - getToken() retrieves decrypted tokens from secure storage
|
|
137
|
+
* - Ideal for multi-tenant, federated auth, or high-security scenarios
|
|
138
|
+
*/
|
|
139
|
+
export declare class OrchestratedAuthorization extends AuthorizationBase {
|
|
140
|
+
#private;
|
|
141
|
+
readonly mode: AuthMode;
|
|
142
|
+
/**
|
|
143
|
+
* Primary provider ID (default for getToken)
|
|
144
|
+
*/
|
|
145
|
+
readonly primaryProviderId?: string;
|
|
146
|
+
private constructor();
|
|
147
|
+
/**
|
|
148
|
+
* Create an OrchestratedAuthorization
|
|
149
|
+
*
|
|
150
|
+
* @param ctx - Creation context
|
|
151
|
+
* @returns A new OrchestratedAuthorization instance
|
|
152
|
+
*
|
|
153
|
+
* @example
|
|
154
|
+
* ```typescript
|
|
155
|
+
* const auth = OrchestratedAuthorization.create({
|
|
156
|
+
* token: localJwt,
|
|
157
|
+
* user: { sub: 'user123', name: 'John' },
|
|
158
|
+
* primaryProviderId: 'github',
|
|
159
|
+
* tokenStore: redisTokenStore,
|
|
160
|
+
* providers: {
|
|
161
|
+
* github: { id: 'github', secretRefId: 'vault:github:user123' },
|
|
162
|
+
* },
|
|
163
|
+
* });
|
|
164
|
+
*
|
|
165
|
+
* // Retrieve token securely (never exposed to LLM)
|
|
166
|
+
* const githubToken = await auth.getToken('github');
|
|
167
|
+
* ```
|
|
168
|
+
*/
|
|
169
|
+
static create(ctx: OrchestratedAuthorizationCreateCtx): OrchestratedAuthorization;
|
|
170
|
+
/**
|
|
171
|
+
* Get access token for a provider
|
|
172
|
+
*
|
|
173
|
+
* Retrieves the decrypted token from the secure store.
|
|
174
|
+
* If the token is expired and refresh is available, attempts refresh.
|
|
175
|
+
*
|
|
176
|
+
* @param providerId - Provider ID (defaults to primaryProviderId)
|
|
177
|
+
* @returns The decrypted access token
|
|
178
|
+
* @throws If no token store or no token available
|
|
179
|
+
*/
|
|
180
|
+
getToken(providerId?: string): Promise<string>;
|
|
181
|
+
/**
|
|
182
|
+
* Refresh token and return new access token
|
|
183
|
+
*/
|
|
184
|
+
private refreshAndGetToken;
|
|
185
|
+
/**
|
|
186
|
+
* Check if a provider has tokens stored
|
|
187
|
+
*/
|
|
188
|
+
hasProvider(providerId: string): boolean;
|
|
189
|
+
/**
|
|
190
|
+
* Get all provider IDs with tokens
|
|
191
|
+
*/
|
|
192
|
+
getProviderIds(): string[];
|
|
193
|
+
/**
|
|
194
|
+
* Add a new provider to this authorization
|
|
195
|
+
* Used when user authorizes additional providers after initial auth
|
|
196
|
+
*/
|
|
197
|
+
addProvider(providerId: string, tokens: {
|
|
198
|
+
accessToken: string;
|
|
199
|
+
refreshToken?: string;
|
|
200
|
+
expiresIn?: number;
|
|
201
|
+
}): Promise<void>;
|
|
202
|
+
/**
|
|
203
|
+
* Add app authorization after initial auth (progressive authorization).
|
|
204
|
+
* Stores app tokens server-side and updates authorized apps without JWT reissue.
|
|
205
|
+
*
|
|
206
|
+
* @param appId - App ID to authorize
|
|
207
|
+
* @param toolIds - Tool IDs accessible through this app authorization
|
|
208
|
+
* @param tokens - OAuth tokens from the app's auth provider
|
|
209
|
+
*
|
|
210
|
+
* @example
|
|
211
|
+
* ```typescript
|
|
212
|
+
* // User clicks auth link for Slack app
|
|
213
|
+
* await auth.addAppAuthorization('slack', ['slack:send_message', 'slack:list_channels'], {
|
|
214
|
+
* accessToken: slackAccessToken,
|
|
215
|
+
* refreshToken: slackRefreshToken,
|
|
216
|
+
* expiresIn: 3600,
|
|
217
|
+
* });
|
|
218
|
+
*
|
|
219
|
+
* // Now slack tools will work without re-auth
|
|
220
|
+
* ```
|
|
221
|
+
*/
|
|
222
|
+
addAppAuthorization(appId: string, toolIds: string[], tokens: {
|
|
223
|
+
accessToken: string;
|
|
224
|
+
refreshToken?: string;
|
|
225
|
+
expiresIn?: number;
|
|
226
|
+
}): Promise<void>;
|
|
227
|
+
/**
|
|
228
|
+
* Get access token for a specific app (for tool execution).
|
|
229
|
+
* Retrieves the app's OAuth token from server-side storage.
|
|
230
|
+
*
|
|
231
|
+
* @param appId - App ID to get token for
|
|
232
|
+
* @returns The decrypted access token, or null if not authorized
|
|
233
|
+
*/
|
|
234
|
+
getAppToken(appId: string): Promise<string | null>;
|
|
235
|
+
/**
|
|
236
|
+
* Check if an app is authorized (includes progressively authorized apps).
|
|
237
|
+
* Overrides base class to include mutable app authorization state.
|
|
238
|
+
*/
|
|
239
|
+
isAppAuthorized(appId: string): boolean;
|
|
240
|
+
/**
|
|
241
|
+
* Get all authorized app IDs (includes progressively authorized apps).
|
|
242
|
+
*/
|
|
243
|
+
getAllAuthorizedAppIds(): string[];
|
|
244
|
+
/**
|
|
245
|
+
* Get tool IDs authorized through an app.
|
|
246
|
+
*/
|
|
247
|
+
getAppToolIds(appId: string): string[] | undefined;
|
|
248
|
+
/**
|
|
249
|
+
* Remove a provider from this authorization
|
|
250
|
+
*/
|
|
251
|
+
removeProvider(providerId: string): Promise<void>;
|
|
252
|
+
/**
|
|
253
|
+
* Get the issuer (local orchestrator)
|
|
254
|
+
*/
|
|
255
|
+
get issuer(): string | undefined;
|
|
256
|
+
}
|
|
257
|
+
//# sourceMappingURL=orchestrated.authorization.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"orchestrated.authorization.d.ts","sourceRoot":"","sources":["../../src/authorization/orchestrated.authorization.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,KAAK,EAAE,sBAAsB,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAExF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAIrD;;;GAGG;AACH,MAAM,WAAW,UAAU;IACzB;;OAEG;IACH,cAAc,CAAC,eAAe,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IAEpF;;OAEG;IACH,eAAe,CAAC,eAAe,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IAErF;;OAEG;IACH,WAAW,CACT,eAAe,EAAE,MAAM,EACvB,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;;OASG;IACG,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAmCpD;;OAEG;YACW,kBAAkB;IAiChC;;OAEG;IACH,WAAW,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO;IAIxC;;OAEG;IACH,cAAc,IAAI,MAAM,EAAE;IAI1B;;;OAGG;IACG,WAAW,CACf,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE;QACN,WAAW,EAAE,MAAM,CAAC;QACpB,YAAY,CAAC,EAAE,MAAM,CAAC;QACtB,SAAS,CAAC,EAAE,MAAM,CAAC;KACpB,GACA,OAAO,CAAC,IAAI,CAAC;IAqChB;;;;;;;;;;;;;;;;;;;OAmBG;IACG,mBAAmB,CACvB,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,MAAM,EAAE,EACjB,MAAM,EAAE;QACN,WAAW,EAAE,MAAM,CAAC;QACpB,YAAY,CAAC,EAAE,MAAM,CAAC;QACtB,SAAS,CAAC,EAAE,MAAM,CAAC;KACpB,GACA,OAAO,CAAC,IAAI,CAAC;IAehB;;;;;;OAMG;IACG,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IAcxD;;;OAGG;IACM,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO;IAIhD;;OAEG;IACH,sBAAsB,IAAI,MAAM,EAAE;IAQlC;;OAEG;IACH,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS;IAIlD;;OAEG;IACG,cAAc,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAOvD;;OAEG;IACH,IAAI,MAAM,IAAI,MAAM,GAAG,SAAS,CAE/B;CACF"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { AuthorizationBase } from './authorization.class';
|
|
2
|
+
import type { AuthMode } from './authorization.types';
|
|
3
|
+
/**
|
|
4
|
+
* Context for creating a PublicAuthorization
|
|
5
|
+
*/
|
|
6
|
+
export interface PublicAuthorizationCreateCtx {
|
|
7
|
+
/**
|
|
8
|
+
* Anonymous user's identifier prefix
|
|
9
|
+
* @default 'anon'
|
|
10
|
+
*/
|
|
11
|
+
prefix?: string;
|
|
12
|
+
/**
|
|
13
|
+
* Anonymous scopes granted to the user
|
|
14
|
+
* @default ['anonymous']
|
|
15
|
+
*/
|
|
16
|
+
scopes?: string[];
|
|
17
|
+
/**
|
|
18
|
+
* Session TTL in milliseconds
|
|
19
|
+
* @default 3600000 (1 hour)
|
|
20
|
+
*/
|
|
21
|
+
ttlMs?: number;
|
|
22
|
+
/**
|
|
23
|
+
* Issuer identifier for the anonymous JWT
|
|
24
|
+
*/
|
|
25
|
+
issuer?: string;
|
|
26
|
+
/**
|
|
27
|
+
* Allowed tools for anonymous access
|
|
28
|
+
* If 'all', all tools are allowed
|
|
29
|
+
*/
|
|
30
|
+
allowedTools?: 'all' | string[];
|
|
31
|
+
/**
|
|
32
|
+
* Allowed prompts for anonymous access
|
|
33
|
+
* If 'all', all prompts are allowed
|
|
34
|
+
*/
|
|
35
|
+
allowedPrompts?: 'all' | string[];
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* PublicAuthorization - Authorization for public/anonymous access mode
|
|
39
|
+
*
|
|
40
|
+
* In public mode:
|
|
41
|
+
* - No authentication is required
|
|
42
|
+
* - Anonymous sessions are auto-generated
|
|
43
|
+
* - getToken() throws - anonymous users cannot access provider tokens
|
|
44
|
+
* - Ideal for development, docs, public wikis, and read-only resources
|
|
45
|
+
*/
|
|
46
|
+
export declare class PublicAuthorization extends AuthorizationBase {
|
|
47
|
+
readonly mode: AuthMode;
|
|
48
|
+
/**
|
|
49
|
+
* Issuer identifier for the anonymous authorization
|
|
50
|
+
*/
|
|
51
|
+
readonly issuer?: string;
|
|
52
|
+
private constructor();
|
|
53
|
+
/**
|
|
54
|
+
* Create a new PublicAuthorization for anonymous access
|
|
55
|
+
*
|
|
56
|
+
* @param ctx - Creation context with optional configuration
|
|
57
|
+
* @returns A new PublicAuthorization instance
|
|
58
|
+
*
|
|
59
|
+
* @example
|
|
60
|
+
* ```typescript
|
|
61
|
+
* const auth = PublicAuthorization.create({
|
|
62
|
+
* scopes: ['read', 'anonymous'],
|
|
63
|
+
* ttlMs: 3600000,
|
|
64
|
+
* allowedTools: ['search', 'get-docs'],
|
|
65
|
+
* });
|
|
66
|
+
* ```
|
|
67
|
+
*/
|
|
68
|
+
static create(ctx?: PublicAuthorizationCreateCtx): PublicAuthorization;
|
|
69
|
+
/**
|
|
70
|
+
* Anonymous users cannot access provider tokens
|
|
71
|
+
*
|
|
72
|
+
* @throws TokenNotAvailableError always - anonymous users do not have provider tokens
|
|
73
|
+
*/
|
|
74
|
+
getToken(_providerId?: string): Promise<string>;
|
|
75
|
+
/**
|
|
76
|
+
* Check if all tools are allowed (public access)
|
|
77
|
+
*/
|
|
78
|
+
get allowsAllTools(): boolean;
|
|
79
|
+
/**
|
|
80
|
+
* Check if all prompts are allowed (public access)
|
|
81
|
+
*/
|
|
82
|
+
get allowsAllPrompts(): boolean;
|
|
83
|
+
/**
|
|
84
|
+
* Override canAccessTool to support 'all' mode
|
|
85
|
+
*/
|
|
86
|
+
canAccessTool(toolId: string): boolean;
|
|
87
|
+
/**
|
|
88
|
+
* Override canAccessPrompt to support 'all' mode
|
|
89
|
+
*/
|
|
90
|
+
canAccessPrompt(promptId: string): boolean;
|
|
91
|
+
}
|
|
92
|
+
//# sourceMappingURL=public.authorization.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"public.authorization.d.ts","sourceRoot":"","sources":["../../src/authorization/public.authorization.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,KAAK,EAAoC,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAGxF;;GAEG;AACH,MAAM,WAAW,4BAA4B;IAC3C;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAElB;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;;OAGG;IACH,YAAY,CAAC,EAAE,KAAK,GAAG,MAAM,EAAE,CAAC;IAEhC;;;OAGG;IACH,cAAc,CAAC,EAAE,KAAK,GAAG,MAAM,EAAE,CAAC;CACnC;AAED;;;;;;;;GAQG;AACH,qBAAa,mBAAoB,SAAQ,iBAAiB;IACxD,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAY;IAEnC;;OAEG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IAEzB,OAAO;IAKP;;;;;;;;;;;;;;OAcG;IACH,MAAM,CAAC,MAAM,CAAC,GAAG,GAAE,4BAAiC,GAAG,mBAAmB;IA6D1E;;;;OAIG;IACG,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAOrD;;OAEG;IACH,IAAI,cAAc,IAAI,OAAO,CAE5B;IAED;;OAEG;IACH,IAAI,gBAAgB,IAAI,OAAO,CAE9B;IAED;;OAEG;IACM,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO;IAQ/C;;OAEG;IACM,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO;CAOpD"}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import { AuthorizationBase } from './authorization.class';
|
|
2
|
+
import type { AuthorizationCreateCtx, AuthMode } from './authorization.types';
|
|
3
|
+
/**
|
|
4
|
+
* Verified JWT payload from transparent auth provider
|
|
5
|
+
*/
|
|
6
|
+
export interface TransparentVerifiedPayload {
|
|
7
|
+
/** Subject identifier */
|
|
8
|
+
sub: string;
|
|
9
|
+
/** Issuer */
|
|
10
|
+
iss?: string;
|
|
11
|
+
/** Audience */
|
|
12
|
+
aud?: string | string[];
|
|
13
|
+
/** Expiration (seconds since epoch) */
|
|
14
|
+
exp?: number;
|
|
15
|
+
/** Issued at (seconds since epoch) */
|
|
16
|
+
iat?: number;
|
|
17
|
+
/** Scopes (space-separated or array) */
|
|
18
|
+
scope?: string | string[];
|
|
19
|
+
/** Display name */
|
|
20
|
+
name?: string;
|
|
21
|
+
/** Email */
|
|
22
|
+
email?: string;
|
|
23
|
+
/** Picture URL */
|
|
24
|
+
picture?: string;
|
|
25
|
+
/** Additional claims */
|
|
26
|
+
[key: string]: unknown;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Context for creating a TransparentAuthorization
|
|
30
|
+
*/
|
|
31
|
+
export interface TransparentAuthorizationCreateCtx {
|
|
32
|
+
/**
|
|
33
|
+
* The original bearer token (passed through to downstream)
|
|
34
|
+
*/
|
|
35
|
+
token: string;
|
|
36
|
+
/**
|
|
37
|
+
* Verified JWT payload from the upstream provider
|
|
38
|
+
*/
|
|
39
|
+
payload: TransparentVerifiedPayload;
|
|
40
|
+
/**
|
|
41
|
+
* Provider ID for this authorization
|
|
42
|
+
*/
|
|
43
|
+
providerId: string;
|
|
44
|
+
/**
|
|
45
|
+
* Provider name for display/logging
|
|
46
|
+
*/
|
|
47
|
+
providerName?: string;
|
|
48
|
+
/**
|
|
49
|
+
* Precomputed authorization projections
|
|
50
|
+
*/
|
|
51
|
+
authorizedTools?: AuthorizationCreateCtx['authorizedTools'];
|
|
52
|
+
authorizedToolIds?: string[];
|
|
53
|
+
authorizedPrompts?: AuthorizationCreateCtx['authorizedPrompts'];
|
|
54
|
+
authorizedPromptIds?: string[];
|
|
55
|
+
authorizedApps?: AuthorizationCreateCtx['authorizedApps'];
|
|
56
|
+
authorizedAppIds?: string[];
|
|
57
|
+
authorizedResources?: string[];
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* TransparentAuthorization - Pass-through OAuth tokens
|
|
61
|
+
*
|
|
62
|
+
* In transparent mode:
|
|
63
|
+
* - The client's token is forwarded directly to downstream services
|
|
64
|
+
* - Token validation happens via the upstream provider's JWKS
|
|
65
|
+
* - getToken() returns the original bearer token
|
|
66
|
+
* - Ideal when the auth server is the source of truth
|
|
67
|
+
*/
|
|
68
|
+
export declare class TransparentAuthorization extends AuthorizationBase {
|
|
69
|
+
readonly mode: AuthMode;
|
|
70
|
+
/**
|
|
71
|
+
* Provider ID that issued the token
|
|
72
|
+
*/
|
|
73
|
+
readonly providerId: string;
|
|
74
|
+
/**
|
|
75
|
+
* Provider display name
|
|
76
|
+
*/
|
|
77
|
+
readonly providerName?: string;
|
|
78
|
+
private constructor();
|
|
79
|
+
/**
|
|
80
|
+
* Create a TransparentAuthorization from a verified JWT
|
|
81
|
+
*
|
|
82
|
+
* @param ctx - Creation context with token and verified payload
|
|
83
|
+
* @returns A new TransparentAuthorization instance
|
|
84
|
+
*
|
|
85
|
+
* @example
|
|
86
|
+
* ```typescript
|
|
87
|
+
* const auth = TransparentAuthorization.fromVerifiedToken({
|
|
88
|
+
* token: bearerToken,
|
|
89
|
+
* payload: verifiedClaims,
|
|
90
|
+
* providerId: 'auth0',
|
|
91
|
+
* });
|
|
92
|
+
*
|
|
93
|
+
* // Pass token through to downstream
|
|
94
|
+
* const token = await auth.getToken();
|
|
95
|
+
* ```
|
|
96
|
+
*/
|
|
97
|
+
static fromVerifiedToken(ctx: TransparentAuthorizationCreateCtx): TransparentAuthorization;
|
|
98
|
+
/**
|
|
99
|
+
* Get the original bearer token for pass-through
|
|
100
|
+
*
|
|
101
|
+
* In transparent mode, the same token is returned regardless of providerId
|
|
102
|
+
* since only one provider (the upstream) issued the token.
|
|
103
|
+
*
|
|
104
|
+
* @param _providerId - Ignored in transparent mode
|
|
105
|
+
* @returns The original bearer token
|
|
106
|
+
*/
|
|
107
|
+
getToken(_providerId?: string): Promise<string>;
|
|
108
|
+
/**
|
|
109
|
+
* Parse scope claim from JWT payload
|
|
110
|
+
*/
|
|
111
|
+
private static parseScopes;
|
|
112
|
+
/**
|
|
113
|
+
* Generate authorization ID from token signature
|
|
114
|
+
* Uses SHA-256 fingerprint of the token signature for uniqueness
|
|
115
|
+
*/
|
|
116
|
+
private static generateAuthorizationId;
|
|
117
|
+
/**
|
|
118
|
+
* Get the issuer from the token claims
|
|
119
|
+
*/
|
|
120
|
+
get issuer(): string | undefined;
|
|
121
|
+
/**
|
|
122
|
+
* Get the audience from the token claims
|
|
123
|
+
*/
|
|
124
|
+
get audience(): string | string[] | undefined;
|
|
125
|
+
/**
|
|
126
|
+
* Check if the token was issued for a specific audience
|
|
127
|
+
*/
|
|
128
|
+
hasAudience(aud: string): boolean;
|
|
129
|
+
}
|
|
130
|
+
//# sourceMappingURL=transparent.authorization.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transparent.authorization.d.ts","sourceRoot":"","sources":["../../src/authorization/transparent.authorization.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,KAAK,EAAE,sBAAsB,EAAY,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAIxF;;GAEG;AACH,MAAM,WAAW,0BAA0B;IACzC,yBAAyB;IACzB,GAAG,EAAE,MAAM,CAAC;IACZ,aAAa;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,eAAe;IACf,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IACxB,uCAAuC;IACvC,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,sCAAsC;IACtC,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,wCAAwC;IACxC,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAC1B,mBAAmB;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,YAAY;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,kBAAkB;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB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AM,GAAG,SAAS,CAE/B;IAED;;OAEG;IACH,IAAI,QAAQ,IAAI,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,CAE5C;IAED;;OAEG;IACH,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO;CAMlC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Logger interface for auth library components.
|
|
3
|
+
* Decouples auth from SDK's FrontMcpLogger.
|
|
4
|
+
*/
|
|
5
|
+
export interface AuthLogger {
|
|
6
|
+
info(msg: string, ...args: unknown[]): void;
|
|
7
|
+
warn(msg: string, ...args: unknown[]): void;
|
|
8
|
+
error(msg: string, ...args: unknown[]): void;
|
|
9
|
+
debug(msg: string, ...args: unknown[]): void;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* No-op logger that discards all messages.
|
|
13
|
+
*/
|
|
14
|
+
export declare const noopAuthLogger: AuthLogger;
|
|
15
|
+
//# sourceMappingURL=auth-logger.interface.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth-logger.interface.d.ts","sourceRoot":"","sources":["../../src/common/auth-logger.interface.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,WAAW,UAAU;IACzB,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;IAC5C,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;IAC5C,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;IAC7C,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;CAC9C;AAED;;GAEG;AACH,eAAO,MAAM,cAAc,EAAE,UAK5B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/common/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC;AACxC,cAAc,aAAa,CAAC;AAC5B,cAAc,sBAAsB,CAAC;AACrC,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export interface JWKParameters {
|
|
3
|
+
/** JWK "kty" (Key Type) Parameter */
|
|
4
|
+
kty?: string;
|
|
5
|
+
/**
|
|
6
|
+
* JWK "alg" (Algorithm) Parameter
|
|
7
|
+
*
|
|
8
|
+
* @see {@link https://github.com/panva/jose/issues/210 Algorithm Key Requirements}
|
|
9
|
+
*/
|
|
10
|
+
alg?: string;
|
|
11
|
+
/** JWK "key_ops" (Key Operations) Parameter */
|
|
12
|
+
key_ops?: string[];
|
|
13
|
+
/** JWK "ext" (Extractable) Parameter */
|
|
14
|
+
ext?: boolean;
|
|
15
|
+
/** JWK "use" (Public Key Use) Parameter */
|
|
16
|
+
use?: string;
|
|
17
|
+
/** JWK "x5c" (X.509 Certificate Chain) Parameter */
|
|
18
|
+
x5c?: string[];
|
|
19
|
+
/** JWK "x5t" (X.509 Certificate SHA-1 Thumbprint) Parameter */
|
|
20
|
+
x5t?: string;
|
|
21
|
+
/** JWK "x5t#S256" (X.509 Certificate SHA-256 Thumbprint) Parameter */
|
|
22
|
+
'x5t#S256'?: string;
|
|
23
|
+
/** JWK "x5u" (X.509 URL) Parameter */
|
|
24
|
+
x5u?: string;
|
|
25
|
+
/** JWK "kid" (Key ID) Parameter */
|
|
26
|
+
kid?: string;
|
|
27
|
+
}
|
|
28
|
+
export declare const jwkParametersSchema: z.ZodObject<{
|
|
29
|
+
kty: z.ZodOptional<z.ZodString>;
|
|
30
|
+
alg: z.ZodOptional<z.ZodString>;
|
|
31
|
+
key_ops: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
32
|
+
ext: z.ZodOptional<z.ZodBoolean>;
|
|
33
|
+
use: z.ZodOptional<z.ZodString>;
|
|
34
|
+
x5c: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
35
|
+
x5t: z.ZodOptional<z.ZodString>;
|
|
36
|
+
'x5t#S256': z.ZodOptional<z.ZodString>;
|
|
37
|
+
x5u: z.ZodOptional<z.ZodString>;
|
|
38
|
+
kid: z.ZodOptional<z.ZodString>;
|
|
39
|
+
}, z.core.$strip>;
|
|
40
|
+
export interface JWK extends JWKParameters {
|
|
41
|
+
/**
|
|
42
|
+
* - EC JWK "crv" (Curve) Parameter
|
|
43
|
+
* - OKP JWK "crv" (The Subtype of Key Pair) Parameter
|
|
44
|
+
*/
|
|
45
|
+
crv?: string;
|
|
46
|
+
/**
|
|
47
|
+
* - Private RSA JWK "d" (Private Exponent) Parameter
|
|
48
|
+
* - Private EC JWK "d" (ECC Private Key) Parameter
|
|
49
|
+
* - Private OKP JWK "d" (The Private Key) Parameter
|
|
50
|
+
*/
|
|
51
|
+
d?: string;
|
|
52
|
+
/** Private RSA JWK "dp" (First Factor CRT Exponent) Parameter */
|
|
53
|
+
dp?: string;
|
|
54
|
+
/** Private RSA JWK "dq" (Second Factor CRT Exponent) Parameter */
|
|
55
|
+
dq?: string;
|
|
56
|
+
/** RSA JWK "e" (Exponent) Parameter */
|
|
57
|
+
e?: string;
|
|
58
|
+
/** Oct JWK "k" (Key Value) Parameter */
|
|
59
|
+
k?: string;
|
|
60
|
+
/** RSA JWK "n" (Modulus) Parameter */
|
|
61
|
+
n?: string;
|
|
62
|
+
/** Private RSA JWK "p" (First Prime Factor) Parameter */
|
|
63
|
+
p?: string;
|
|
64
|
+
/** Private RSA JWK "q" (Second Prime Factor) Parameter */
|
|
65
|
+
q?: string;
|
|
66
|
+
/** Private RSA JWK "qi" (First CRT Coefficient) Parameter */
|
|
67
|
+
qi?: string;
|
|
68
|
+
/**
|
|
69
|
+
* - EC JWK "x" (X Coordinate) Parameter
|
|
70
|
+
* - OKP JWK "x" (The public key) Parameter
|
|
71
|
+
*/
|
|
72
|
+
x?: string;
|
|
73
|
+
/** EC JWK "y" (Y Coordinate) Parameter */
|
|
74
|
+
y?: string;
|
|
75
|
+
/** AKP JWK "pub" (Public Key) Parameter */
|
|
76
|
+
pub?: string;
|
|
77
|
+
/** AKP JWK "priv" (Private key) Parameter */
|
|
78
|
+
priv?: string;
|
|
79
|
+
}
|
|
80
|
+
export declare const jwkSchema: z.ZodType<JWK>;
|
|
81
|
+
export interface JSONWebKeySet {
|
|
82
|
+
keys: JWK[];
|
|
83
|
+
}
|
|
84
|
+
export declare const jsonWebKeySetSchema: z.ZodObject<{
|
|
85
|
+
keys: z.ZodArray<z.ZodType<JWK, unknown, z.core.$ZodTypeInternals<JWK, unknown>>>;
|
|
86
|
+
}, z.core.$strip>;
|
|
87
|
+
//# sourceMappingURL=jwt.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jwt.types.d.ts","sourceRoot":"","sources":["../../src/common/jwt.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,MAAM,WAAW,aAAa;IAC5B,qCAAqC;IACrC,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;;;;OAIG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,+CAA+C;IAC/C,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,wCAAwC;IACxC,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,2CAA2C;IAC3C,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,oDAAoD;IACpD,GAAG,CAAC,EAAE,MAAM,EAAE,CAAC;IACf,+DAA+D;IAC/D,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,sEAAsE;IACtE,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,sCAAsC;IACtC,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,mCAAmC;IACnC,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED,eAAO,MAAM,mBAAmB;;;;;;;;;;;iBAWO,CAAC;AAExC,MAAM,WAAW,GAAI,SAAQ,aAAa;IACxC;;;OAGG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;;;;OAIG;IACH,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,iEAAiE;IACjE,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,kEAAkE;IAClE,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,uCAAuC;IACvC,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,wCAAwC;IACxC,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,sCAAsC;IACtC,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,yDAAyD;IACzD,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,0DAA0D;IAC1D,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,6DAA6D;IAC7D,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ;;;OAGG;IACH,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,0CAA0C;IAC1C,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,2CAA2C;IAC3C,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,6CAA6C;IAC7C,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,eAAO,MAAM,SAAS,EAAE,CAAC,CAAC,OAAO,CAAC,GAAG,CAeO,CAAC;AAE7C,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,GAAG,EAAE,CAAC;CACb;AAED,eAAO,MAAM,mBAAmB;;iBAEO,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Portable session user type extracted from SDK's session.base.ts.
|
|
3
|
+
* Used by auth components that need user identity without SDK Scope dependency.
|
|
4
|
+
*/
|
|
5
|
+
export interface SessionUser {
|
|
6
|
+
sub?: string;
|
|
7
|
+
name?: string;
|
|
8
|
+
email?: string;
|
|
9
|
+
picture?: string;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Generic session claims map.
|
|
13
|
+
*/
|
|
14
|
+
export interface SessionClaims {
|
|
15
|
+
[key: string]: unknown;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=session-user.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session-user.types.d.ts","sourceRoot":"","sources":["../../src/common/session-user.types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,WAAW,WAAW;IAC1B,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB"}
|