@mastra/auth-workos 1.6.6 → 1.6.7

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.
@@ -50,6 +50,14 @@ export interface IMastraAuthProvider<TUser = unknown> {
50
50
  * Map an authenticated user to a memory resource id
51
51
  */
52
52
  mapUserToResourceId?(user: TUser): string | undefined | null;
53
+ /**
54
+ * Return response headers (typically `Set-Cookie` for a rotated session)
55
+ * that the provider accumulated while handling this request and clear them
56
+ * from the provider's per-request state. The server middleware appends them
57
+ * to the outgoing response so that server-to-server session refreshes
58
+ * reach the browser.
59
+ */
60
+ consumePendingResponseHeaders?(request: MastraAuthRequest): Record<string, string> | undefined;
53
61
  }
54
62
  export declare abstract class MastraAuthProvider<TUser = unknown> extends MastraBase implements IMastraAuthProvider<TUser> {
55
63
  protected?: MastraAuthConfig['protected'];
@@ -97,6 +105,7 @@ export declare class CompositeAuth extends MastraAuthProvider implements ISSOPro
97
105
  */
98
106
  get isSimpleAuth(): boolean;
99
107
  authenticateToken(token: string, request: MastraAuthRequest): Promise<unknown | null>;
108
+ consumePendingResponseHeaders(request: MastraAuthRequest): Record<string, string> | undefined;
100
109
  authorizeUser(user: unknown, request: MastraAuthRequest): Promise<boolean>;
101
110
  /**
102
111
  * Forward cookie header to SSO provider for PKCE validation.
package/dist/index.cjs CHANGED
@@ -357,7 +357,7 @@ function getWebRequest(request) {
357
357
  * Generated once per process to ensure consistency during dev.
358
358
  */
359
359
  const DEV_COOKIE_PASSWORD = crypto.randomUUID() + crypto.randomUUID();
360
- const MEMBERSHIP_CACHE_TTL_MS = 60 * 1e3;
360
+ const MEMBERSHIP_CACHE_TTL_MS = 6e4;
361
361
  const MEMBERSHIP_CACHE_MAX_SIZE = 1e3;
362
362
  /** Pull a stable error code out of a WorkOS SDK error, if present. */
363
363
  function workosErrorCode(error) {
@@ -438,7 +438,7 @@ var MastraAuthWorkos = class extends MastraAuthProvider {
438
438
  redirectUri,
439
439
  cookiePassword,
440
440
  cookieName: options?.session?.cookieName ?? "wos_session",
441
- cookieMaxAge: options?.session?.maxAge ?? 3600 * 24 * 400,
441
+ cookieMaxAge: options?.session?.maxAge ?? 3456e4,
442
442
  cookieSameSite: options?.session?.sameSite?.toLowerCase(),
443
443
  cookieDomain: void 0,
444
444
  apiHttps: true
@@ -473,7 +473,8 @@ var MastraAuthWorkos = class extends MastraAuthProvider {
473
473
  };
474
474
  }
475
475
  if (token) {
476
- const payload = await (0, _mastra_auth.verifyJwks)(token, this.workos.userManagement.getJwksUrl(this.clientId));
476
+ const jwksUri = this.workos.userManagement.getJwksUrl(this.clientId);
477
+ const payload = await (0, _mastra_auth.verifyJwks)(token, jwksUri);
477
478
  const jwtUser = this.resolveJwtPayloadUser(payload);
478
479
  if (this.trustJwtClaims && jwtUser?.id && jwtUser?.workosId) return await this.attachMembershipsIfNeeded(jwtUser);
479
480
  if (payload?.sub) try {
@@ -940,7 +941,7 @@ var MastraAuthWorkos = class extends MastraAuthProvider {
940
941
  }
941
942
  };
942
943
  //#endregion
943
- //#region ../../packages/_internals/auth/dist/ee-btY6vXIW.js
944
+ //#region ../../packages/_internals/auth/dist/ee-XRuijAiF.js
944
945
  /**
945
946
  * FGA enforcement utility for checking fine-grained authorization.
946
947
  *
@@ -1106,7 +1107,7 @@ function resolvePermissionsFromMapping(roles, mapping) {
1106
1107
  * ```
1107
1108
  */
1108
1109
  /** Default cache TTL in milliseconds (60 seconds) */
1109
- const DEFAULT_CACHE_TTL_MS = 60 * 1e3;
1110
+ const DEFAULT_CACHE_TTL_MS = 6e4;
1110
1111
  /** Default max cache size (number of users) */
1111
1112
  const DEFAULT_CACHE_MAX_SIZE = 1e3;
1112
1113
  var MastraRBACWorkos = class {