@mastra/auth-studio 1.3.11 → 1.4.0-alpha.1
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/_types/{@internal_auth/dist/_types/@internal_core → @internal_auth@0.0.36/dist/_types/@internal_core@0.1.4}/dist/base/index.d.ts +1 -1
- package/dist/_types/{@internal_auth/dist/_types/@internal_core/dist/index-TNVgGNjs.d.ts → @internal_auth@0.0.36/dist/_types/@internal_core@0.1.4/dist/index-Diz1p9N7.d.ts} +3 -2
- package/dist/_types/{@internal_auth → @internal_auth@0.0.36}/dist/ee/interfaces/permissions.generated.d.ts +12 -2
- package/dist/_types/{@internal_auth → @internal_auth@0.0.36}/dist/provider/index.d.ts +1 -1
- package/dist/index.cjs +69 -26
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +17 -12
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +69 -26
- package/dist/index.js.map +1 -1
- package/package.json +7 -7
- /package/dist/_types/{@internal_auth → @internal_auth@0.0.36}/dist/ee/capabilities.d.ts +0 -0
- /package/dist/_types/{@internal_auth → @internal_auth@0.0.36}/dist/ee/defaults/index.d.ts +0 -0
- /package/dist/_types/{@internal_auth → @internal_auth@0.0.36}/dist/ee/defaults/rbac/index.d.ts +0 -0
- /package/dist/_types/{@internal_auth → @internal_auth@0.0.36}/dist/ee/defaults/rbac/static.d.ts +0 -0
- /package/dist/_types/{@internal_auth → @internal_auth@0.0.36}/dist/ee/defaults/roles.d.ts +0 -0
- /package/dist/_types/{@internal_auth → @internal_auth@0.0.36}/dist/ee/fga-check.d.ts +0 -0
- /package/dist/_types/{@internal_auth → @internal_auth@0.0.36}/dist/ee/index.d.ts +0 -0
- /package/dist/_types/{@internal_auth → @internal_auth@0.0.36}/dist/ee/interfaces/acl.d.ts +0 -0
- /package/dist/_types/{@internal_auth → @internal_auth@0.0.36}/dist/ee/interfaces/fga.d.ts +0 -0
- /package/dist/_types/{@internal_auth → @internal_auth@0.0.36}/dist/ee/interfaces/index.d.ts +0 -0
- /package/dist/_types/{@internal_auth → @internal_auth@0.0.36}/dist/ee/interfaces/rbac.d.ts +0 -0
- /package/dist/_types/{@internal_auth → @internal_auth@0.0.36}/dist/ee/interfaces/user.d.ts +0 -0
- /package/dist/_types/{@internal_auth → @internal_auth@0.0.36}/dist/ee/license.d.ts +0 -0
- /package/dist/_types/{@internal_auth → @internal_auth@0.0.36}/dist/index.d.ts +0 -0
- /package/dist/_types/{@internal_auth → @internal_auth@0.0.36}/dist/session/cookie.d.ts +0 -0
- /package/dist/_types/{@internal_auth → @internal_auth@0.0.36}/dist/session/index.d.ts +0 -0
- /package/dist/_types/{@internal_auth → @internal_auth@0.0.36}/dist/session/memory.d.ts +0 -0
- /package/dist/_types/{@internal_auth → @internal_auth@0.0.36}/dist/types/index.d.ts +0 -0
- /package/dist/_types/{@internal_auth → @internal_auth@0.0.36}/package.json +0 -0
|
@@ -90,6 +90,7 @@ declare function exportTrackedException(ctx: LoggerAdapterContext | undefined, e
|
|
|
90
90
|
* so the derived record preserves all context from the native call.
|
|
91
91
|
*/
|
|
92
92
|
declare function buildLogRecordData(args: unknown[]): Record<string, unknown> | undefined;
|
|
93
|
+
declare const noopLogger: IMastraLogger;
|
|
93
94
|
declare const RegisteredLogger: {
|
|
94
95
|
readonly AGENT: 'AGENT';
|
|
95
96
|
readonly OBSERVABILITY: 'OBSERVABILITY';
|
|
@@ -311,5 +312,5 @@ declare class ConsoleLogger extends MastraLogger {
|
|
|
311
312
|
hasMore: boolean;
|
|
312
313
|
}>;
|
|
313
314
|
}
|
|
314
|
-
export {
|
|
315
|
-
//# sourceMappingURL=index-
|
|
315
|
+
export { TraceFields as _, LogFilter as a, isAdaptableLogger as b, LoggerTransport as c, createCustomTransport as d, noopLogger as f, LoggerAdapterOptions as g, LoggerAdapterContext as h, IMastraLogger as i, MastraLogger as l, AdapterLogSink as m, ConsoleLogger as n, LogFilterContext as o, AdaptableLogger as p, ConsoleLoggerOptions as r, LogLevel as s, BaseLogMessage as t, RegisteredLogger as u, buildLogRecordData as v, exportTrackedException as y };
|
|
316
|
+
//# sourceMappingURL=index-Diz1p9N7.d.ts.map
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* All known API resources.
|
|
11
11
|
* Derived from SERVER_ROUTES paths in @mastra/server.
|
|
12
12
|
*/
|
|
13
|
-
export declare const RESOURCES: readonly ['a2a', 'agent-builder', 'agent-controller', 'agents', 'auth', 'background-tasks', 'channels', 'datasets', 'embedders', 'experiments', 'infrastructure', 'logs', 'mcp', 'memory', 'observability', 'processor-providers', 'processors', 'schedules', 'scores', 'stored-agents', 'stored-mcp-clients', 'stored-prompt-blocks', 'stored-scorers', 'stored-skills', 'stored-workflows', 'stored-workspaces', 'system', 'tool-providers', 'tools', 'vector', 'vectors', 'workflows', 'workspaces'];
|
|
13
|
+
export declare const RESOURCES: readonly ['a2a', 'agent-builder', 'agent-controller', 'agents', 'auth', 'background-tasks', 'channels', 'datasets', 'embedders', 'experiments', 'infrastructure', 'knowledge', 'logs', 'mcp', 'memory', 'observability', 'processor-providers', 'processors', 'schedules', 'scores', 'stored-agents', 'stored-mcp-clients', 'stored-prompt-blocks', 'stored-scorers', 'stored-skills', 'stored-workflows', 'stored-workspaces', 'system', 'tool-providers', 'tools', 'vector', 'vectors', 'workflows', 'workspaces'];
|
|
14
14
|
/**
|
|
15
15
|
* Resource type union.
|
|
16
16
|
*/
|
|
@@ -72,6 +72,8 @@ export declare const PERMISSION_PATTERNS: {
|
|
|
72
72
|
readonly 'experiments:*': 'experiments:*';
|
|
73
73
|
/** Full access to infrastructure */
|
|
74
74
|
readonly 'infrastructure:*': 'infrastructure:*';
|
|
75
|
+
/** Full access to knowledge */
|
|
76
|
+
readonly 'knowledge:*': 'knowledge:*';
|
|
75
77
|
/** Full access to logs */
|
|
76
78
|
readonly 'logs:*': 'logs:*';
|
|
77
79
|
/** Full access to MCP servers */
|
|
@@ -142,6 +144,8 @@ export declare const PERMISSION_PATTERNS: {
|
|
|
142
144
|
readonly 'agents:write': 'agents:write';
|
|
143
145
|
/** View auth */
|
|
144
146
|
readonly 'auth:read': 'auth:read';
|
|
147
|
+
/** Execute background tasks */
|
|
148
|
+
readonly 'background-tasks:execute': 'background-tasks:execute';
|
|
145
149
|
/** View background tasks */
|
|
146
150
|
readonly 'background-tasks:read': 'background-tasks:read';
|
|
147
151
|
/** View channels */
|
|
@@ -164,6 +168,8 @@ export declare const PERMISSION_PATTERNS: {
|
|
|
164
168
|
readonly 'experiments:read': 'experiments:read';
|
|
165
169
|
/** View infrastructure */
|
|
166
170
|
readonly 'infrastructure:read': 'infrastructure:read';
|
|
171
|
+
/** View knowledge */
|
|
172
|
+
readonly 'knowledge:read': 'knowledge:read';
|
|
167
173
|
/** View logs */
|
|
168
174
|
readonly 'logs:read': 'logs:read';
|
|
169
175
|
/** Execute MCP servers */
|
|
@@ -315,7 +321,7 @@ export type PermissionPattern = keyof typeof PERMISSION_PATTERNS;
|
|
|
315
321
|
/**
|
|
316
322
|
* All valid resource:action permission combinations (excludes wildcards).
|
|
317
323
|
*/
|
|
318
|
-
export declare const PERMISSIONS: readonly ['a2a:read', 'a2a:write', 'agent-builder:execute', 'agent-builder:read', 'agent-builder:write', 'agent-controller:execute', 'agent-controller:read', 'agents:create', 'agents:delete', 'agents:execute', 'agents:read', 'agents:write', 'auth:read', 'background-tasks:read', 'channels:read', 'channels:write', 'datasets:delete', 'datasets:execute', 'datasets:read', 'datasets:write', 'embedders:read', 'experiments:delete', 'experiments:read', 'infrastructure:read', 'logs:read', 'mcp:execute', 'mcp:read', 'mcp:write', 'memory:delete', 'memory:execute', 'memory:read', 'memory:write', 'observability:delete', 'observability:read', 'observability:write', 'processor-providers:read', 'processors:execute', 'processors:read', 'schedules:delete', 'schedules:execute', 'schedules:read', 'schedules:write', 'scores:read', 'scores:write', 'stored-agents:delete', 'stored-agents:publish', 'stored-agents:read', 'stored-agents:write', 'stored-mcp-clients:delete', 'stored-mcp-clients:publish', 'stored-mcp-clients:read', 'stored-mcp-clients:write', 'stored-prompt-blocks:delete', 'stored-prompt-blocks:publish', 'stored-prompt-blocks:read', 'stored-prompt-blocks:write', 'stored-scorers:delete', 'stored-scorers:publish', 'stored-scorers:read', 'stored-scorers:write', 'stored-skills:delete', 'stored-skills:publish', 'stored-skills:read', 'stored-skills:write', 'stored-workflows:read', 'stored-workflows:write', 'stored-workspaces:delete', 'stored-workspaces:read', 'stored-workspaces:write', 'system:read', 'tool-providers:delete', 'tool-providers:read', 'tool-providers:write', 'tools:execute', 'tools:read', 'vector:delete', 'vector:execute', 'vector:read', 'vector:write', 'vectors:read', 'workflows:delete', 'workflows:execute', 'workflows:read', 'workflows:write', 'workspaces:delete', 'workspaces:read', 'workspaces:write'];
|
|
324
|
+
export declare const PERMISSIONS: readonly ['a2a:read', 'a2a:write', 'agent-builder:execute', 'agent-builder:read', 'agent-builder:write', 'agent-controller:execute', 'agent-controller:read', 'agents:create', 'agents:delete', 'agents:execute', 'agents:read', 'agents:write', 'auth:read', 'background-tasks:execute', 'background-tasks:read', 'channels:read', 'channels:write', 'datasets:delete', 'datasets:execute', 'datasets:read', 'datasets:write', 'embedders:read', 'experiments:delete', 'experiments:read', 'infrastructure:read', 'knowledge:read', 'logs:read', 'mcp:execute', 'mcp:read', 'mcp:write', 'memory:delete', 'memory:execute', 'memory:read', 'memory:write', 'observability:delete', 'observability:read', 'observability:write', 'processor-providers:read', 'processors:execute', 'processors:read', 'schedules:delete', 'schedules:execute', 'schedules:read', 'schedules:write', 'scores:read', 'scores:write', 'stored-agents:delete', 'stored-agents:publish', 'stored-agents:read', 'stored-agents:write', 'stored-mcp-clients:delete', 'stored-mcp-clients:publish', 'stored-mcp-clients:read', 'stored-mcp-clients:write', 'stored-prompt-blocks:delete', 'stored-prompt-blocks:publish', 'stored-prompt-blocks:read', 'stored-prompt-blocks:write', 'stored-scorers:delete', 'stored-scorers:publish', 'stored-scorers:read', 'stored-scorers:write', 'stored-skills:delete', 'stored-skills:publish', 'stored-skills:read', 'stored-skills:write', 'stored-workflows:read', 'stored-workflows:write', 'stored-workspaces:delete', 'stored-workspaces:read', 'stored-workspaces:write', 'system:read', 'tool-providers:delete', 'tool-providers:read', 'tool-providers:write', 'tools:execute', 'tools:read', 'vector:delete', 'vector:execute', 'vector:read', 'vector:write', 'vectors:read', 'workflows:delete', 'workflows:execute', 'workflows:read', 'workflows:write', 'workspaces:delete', 'workspaces:read', 'workspaces:write'];
|
|
319
325
|
/**
|
|
320
326
|
* Specific permission type (e.g., 'agents:read', 'workflows:execute').
|
|
321
327
|
*/
|
|
@@ -353,6 +359,8 @@ export declare const MastraFGAPermissions: {
|
|
|
353
359
|
readonly AGENTS_WRITE: 'agents:write';
|
|
354
360
|
/** View auth */
|
|
355
361
|
readonly AUTH_READ: 'auth:read';
|
|
362
|
+
/** Execute background tasks */
|
|
363
|
+
readonly BACKGROUND_TASKS_EXECUTE: 'background-tasks:execute';
|
|
356
364
|
/** View background tasks */
|
|
357
365
|
readonly BACKGROUND_TASKS_READ: 'background-tasks:read';
|
|
358
366
|
/** View channels */
|
|
@@ -375,6 +383,8 @@ export declare const MastraFGAPermissions: {
|
|
|
375
383
|
readonly EXPERIMENTS_READ: 'experiments:read';
|
|
376
384
|
/** View infrastructure */
|
|
377
385
|
readonly INFRASTRUCTURE_READ: 'infrastructure:read';
|
|
386
|
+
/** View knowledge */
|
|
387
|
+
readonly KNOWLEDGE_READ: 'knowledge:read';
|
|
378
388
|
/** View logs */
|
|
379
389
|
readonly LOGS_READ: 'logs:read';
|
|
380
390
|
/** Execute MCP servers */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MastraBase } from '../_types/@internal_core/dist/base/index.js';
|
|
1
|
+
import { MastraBase } from '../_types/@internal_core@0.1.4/dist/base/index.js';
|
|
2
2
|
import type { CredentialsResult, IAuthHttpHandler, IAuthInit, ICredentialsProvider, IOrganizationsProvider, ISSOProvider, ISessionProvider, IUserProvider, Session, SSOCallbackResult, SSOLoginConfig, User } from '..';
|
|
3
3
|
import type { AuthorizeUserFn, MastraAuthConfig, MastraAuthRequest } from '../types/index.js';
|
|
4
4
|
export interface MastraAuthProviderOptions<TUser = unknown> {
|
package/dist/index.cjs
CHANGED
|
@@ -313,7 +313,7 @@ var MastraAuthProvider = class extends MastraBase {
|
|
|
313
313
|
if (opts?.public) this.public = opts.public;
|
|
314
314
|
}
|
|
315
315
|
};
|
|
316
|
-
// ../../packages/_internals/auth/dist/ee-
|
|
316
|
+
// ../../packages/_internals/auth/dist/ee-iTj2bRDt.js
|
|
317
317
|
/**
|
|
318
318
|
* FGA enforcement utility for checking fine-grained authorization.
|
|
319
319
|
*
|
|
@@ -525,6 +525,7 @@ var MastraAuthStudio = class extends MastraAuthProvider {
|
|
|
525
525
|
* caller's promise is reused by every follower until it settles.
|
|
526
526
|
*/
|
|
527
527
|
organizationBootstrapInFlight = /* @__PURE__ */ new Map();
|
|
528
|
+
sessionVerificationsInFlight = /* @__PURE__ */ new Map();
|
|
528
529
|
/**
|
|
529
530
|
* Per-request response headers to forward to the browser — specifically a
|
|
530
531
|
* rotated `wos-session` `Set-Cookie` returned by the shared API when the
|
|
@@ -538,6 +539,8 @@ var MastraAuthStudio = class extends MastraAuthProvider {
|
|
|
538
539
|
* requests after the response is written.
|
|
539
540
|
*/
|
|
540
541
|
pendingResponseHeaders = /* @__PURE__ */ new WeakMap();
|
|
542
|
+
/** The request's current sealed cookie once a shared API call renewed it: the inbound one's refresh token is spent. */
|
|
543
|
+
renewedSessionCookies = /* @__PURE__ */ new WeakMap();
|
|
541
544
|
constructor(options) {
|
|
542
545
|
super({
|
|
543
546
|
name: "mastra-studio",
|
|
@@ -965,33 +968,28 @@ var MastraAuthStudio = class extends MastraAuthProvider {
|
|
|
965
968
|
const single = res.headers.get("Set-Cookie");
|
|
966
969
|
return single ? [single] : [];
|
|
967
970
|
}
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
* response, stash the `Set-Cookie` header against the inbound request so
|
|
971
|
-
* the server middleware can forward it to the browser, and invalidate the
|
|
972
|
-
* short-TTL verification cache entry for the old cookie value. Returns the
|
|
973
|
-
* rotated sealed value, or null when the cookie was not rotated.
|
|
974
|
-
*/
|
|
975
|
-
captureRotatedCookie(res, oldSessionCookie, oldCacheKey, request) {
|
|
976
|
-
const setCookies = this.readSetCookieHeaders(res);
|
|
977
|
-
if (setCookies.length === 0) return null;
|
|
978
|
-
const rotatedCookieHeader = setCookies.find((h) => parseCookieFromHeader(h, COOKIE_NAME) !== null);
|
|
971
|
+
readRotatedCookie(res, oldSessionCookie) {
|
|
972
|
+
const rotatedCookieHeader = this.readSetCookieHeaders(res).find((h) => parseCookieFromHeader(h, COOKIE_NAME) !== null);
|
|
979
973
|
if (!rotatedCookieHeader) return null;
|
|
980
974
|
const rotatedValue = parseCookieFromHeader(rotatedCookieHeader, COOKIE_NAME);
|
|
981
975
|
if (!rotatedValue || rotatedValue === oldSessionCookie) return null;
|
|
976
|
+
return rotatedValue;
|
|
977
|
+
}
|
|
978
|
+
forwardRotatedCookie(rotatedValue, request) {
|
|
979
|
+
if (!request) return;
|
|
980
|
+
const rawRequest = getWebRequest(request);
|
|
981
|
+
if (!rawRequest) {
|
|
982
|
+
this.logger.warn("forwardRotatedCookie: renewed session cookie cannot be forwarded (no web Request)");
|
|
983
|
+
return;
|
|
984
|
+
}
|
|
982
985
|
const reissued = this.getSessionHeaders({
|
|
983
986
|
id: rotatedValue,
|
|
984
987
|
userId: "",
|
|
985
988
|
expiresAt: /* @__PURE__ */ new Date(),
|
|
986
989
|
createdAt: /* @__PURE__ */ new Date()
|
|
987
990
|
});
|
|
988
|
-
this.
|
|
989
|
-
|
|
990
|
-
const rawRequest = getWebRequest(request);
|
|
991
|
-
if (rawRequest) this.pendingResponseHeaders.set(rawRequest, reissued);
|
|
992
|
-
else this.logger.warn("captureRotatedCookie: renewed session cookie cannot be forwarded (no web Request)");
|
|
993
|
-
}
|
|
994
|
-
return rotatedValue;
|
|
991
|
+
this.pendingResponseHeaders.set(rawRequest, reissued);
|
|
992
|
+
this.renewedSessionCookies.set(rawRequest, rotatedValue);
|
|
995
993
|
}
|
|
996
994
|
/**
|
|
997
995
|
* Server middleware hook: emit any response headers the provider
|
|
@@ -1007,6 +1005,29 @@ var MastraAuthStudio = class extends MastraAuthProvider {
|
|
|
1007
1005
|
return headers;
|
|
1008
1006
|
}
|
|
1009
1007
|
/**
|
|
1008
|
+
* Call the shared API as the request's signed-in user. The shared API acts on the
|
|
1009
|
+
* session's active organization, not the pinned one. A renewed session cookie is
|
|
1010
|
+
* queued for {@link consumePendingResponseHeaders} and sent by later calls for the
|
|
1011
|
+
* same request. Returns `null` when the request has no session.
|
|
1012
|
+
*/
|
|
1013
|
+
async fetchAsRequestUser(request, path, init = {}) {
|
|
1014
|
+
const sessionCookie = this.renewedSessionCookies.get(request) ?? this.getSessionIdFromRequest(request);
|
|
1015
|
+
if (!sessionCookie) return null;
|
|
1016
|
+
const headers = new Headers(init.headers);
|
|
1017
|
+
headers.set("Cookie", `${COOKIE_NAME}=${sessionCookie}`);
|
|
1018
|
+
const res = await fetch(`${this.sharedApiUrl}${path}`, {
|
|
1019
|
+
...init,
|
|
1020
|
+
headers,
|
|
1021
|
+
signal: init.signal ?? AbortSignal.timeout(VERIFY_FETCH_TIMEOUT_MS)
|
|
1022
|
+
});
|
|
1023
|
+
const rotatedCookie = this.readRotatedCookie(res, sessionCookie);
|
|
1024
|
+
if (rotatedCookie) {
|
|
1025
|
+
this.verifiedCredentials.delete(await this.verificationKey("cookie", sessionCookie));
|
|
1026
|
+
this.forwardRotatedCookie(rotatedCookie, request);
|
|
1027
|
+
}
|
|
1028
|
+
return res;
|
|
1029
|
+
}
|
|
1030
|
+
/**
|
|
1010
1031
|
* Fetch the shared API's `/auth/me` and return the raw response body, or
|
|
1011
1032
|
* `null` on any non-OK / network error. Split out so `ensureOrganization`
|
|
1012
1033
|
* and `isOrganizationAdmin` can reuse it without duplicating the shape.
|
|
@@ -1034,22 +1055,38 @@ var MastraAuthStudio = class extends MastraAuthProvider {
|
|
|
1034
1055
|
this.rememberUserSession(cached.id, sessionCookie);
|
|
1035
1056
|
return cached;
|
|
1036
1057
|
}
|
|
1058
|
+
let verification = this.sessionVerificationsInFlight.get(cacheKey);
|
|
1059
|
+
if (!verification) {
|
|
1060
|
+
verification = this.doVerifySessionCookie(cacheKey, sessionCookie).finally(() => {
|
|
1061
|
+
this.sessionVerificationsInFlight.delete(cacheKey);
|
|
1062
|
+
});
|
|
1063
|
+
this.sessionVerificationsInFlight.set(cacheKey, verification);
|
|
1064
|
+
}
|
|
1065
|
+
const { user, rotatedCookie } = await verification;
|
|
1066
|
+
if (rotatedCookie) this.forwardRotatedCookie(rotatedCookie, request);
|
|
1067
|
+
if (user) this.rememberUserSession(user.id, rotatedCookie ?? sessionCookie);
|
|
1068
|
+
return user;
|
|
1069
|
+
}
|
|
1070
|
+
async doVerifySessionCookie(cacheKey, sessionCookie) {
|
|
1071
|
+
let rotatedCookie = null;
|
|
1037
1072
|
try {
|
|
1038
1073
|
const res = await fetch(`${this.sharedApiUrl}/auth/me`, {
|
|
1039
1074
|
headers: { Cookie: `${COOKIE_NAME}=${sessionCookie}` },
|
|
1040
1075
|
signal: AbortSignal.timeout(VERIFY_FETCH_TIMEOUT_MS)
|
|
1041
1076
|
});
|
|
1042
|
-
|
|
1077
|
+
rotatedCookie = this.readRotatedCookie(res, sessionCookie);
|
|
1043
1078
|
if (!res.ok) {
|
|
1044
1079
|
this.logger.warn("verifySessionCookie: shared API returned non-OK status", {
|
|
1045
1080
|
status: res.status,
|
|
1046
1081
|
statusText: res.statusText,
|
|
1047
1082
|
url: `${this.sharedApiUrl}/auth/me`
|
|
1048
1083
|
});
|
|
1049
|
-
return
|
|
1084
|
+
return {
|
|
1085
|
+
user: null,
|
|
1086
|
+
rotatedCookie
|
|
1087
|
+
};
|
|
1050
1088
|
}
|
|
1051
1089
|
const data = await res.json();
|
|
1052
|
-
this.rememberUserSession(data.user.id, rotated ?? sessionCookie);
|
|
1053
1090
|
const sessionUser = {
|
|
1054
1091
|
id: data.user.id,
|
|
1055
1092
|
email: data.user.email,
|
|
@@ -1060,9 +1097,12 @@ var MastraAuthStudio = class extends MastraAuthProvider {
|
|
|
1060
1097
|
permissions: data.permissions,
|
|
1061
1098
|
memberOrgIds: data.memberOrgIds
|
|
1062
1099
|
};
|
|
1063
|
-
const user = await this.asPinnedOrganizationMember(sessionUser, sessionCookie);
|
|
1064
|
-
if (user.organizationId && !
|
|
1065
|
-
return
|
|
1100
|
+
const user = await this.asPinnedOrganizationMember(sessionUser, rotatedCookie ?? sessionCookie);
|
|
1101
|
+
if (user.organizationId && !rotatedCookie) this.cacheVerification(cacheKey, user);
|
|
1102
|
+
return {
|
|
1103
|
+
user,
|
|
1104
|
+
rotatedCookie
|
|
1105
|
+
};
|
|
1066
1106
|
} catch (error) {
|
|
1067
1107
|
this.logger.error("verifySessionCookie: fetch to shared API failed", {
|
|
1068
1108
|
url: `${this.sharedApiUrl}/auth/me`,
|
|
@@ -1071,7 +1111,10 @@ var MastraAuthStudio = class extends MastraAuthProvider {
|
|
|
1071
1111
|
stack: error.stack
|
|
1072
1112
|
} : String(error)
|
|
1073
1113
|
});
|
|
1074
|
-
return
|
|
1114
|
+
return {
|
|
1115
|
+
user: null,
|
|
1116
|
+
rotatedCookie
|
|
1117
|
+
};
|
|
1075
1118
|
}
|
|
1076
1119
|
}
|
|
1077
1120
|
/**
|