@mastra/auth-cloud 1.2.6 → 1.2.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
@@ -421,7 +421,7 @@ const SESSION_COOKIE_NAME = "mastra_cloud_session";
421
421
  * @returns Set-Cookie header value
422
422
  */
423
423
  function setSessionCookie(token, isProduction) {
424
- let cookie = `${SESSION_COOKIE_NAME}=${token}; HttpOnly; SameSite=Lax; Path=/; Max-Age=${1440 * 60}`;
424
+ let cookie = `${SESSION_COOKIE_NAME}=${token}; HttpOnly; SameSite=Lax; Path=/; Max-Age=86400`;
425
425
  if (isProduction) cookie += "; Secure";
426
426
  return cookie;
427
427
  }
@@ -984,7 +984,7 @@ var MastraAuthProvider = class extends MastraBase {
984
984
  }
985
985
  };
986
986
  //#endregion
987
- //#region ../../packages/_internals/auth/dist/ee-btY6vXIW.js
987
+ //#region ../../packages/_internals/auth/dist/ee-XRuijAiF.js
988
988
  /**
989
989
  * FGA enforcement utility for checking fine-grained authorization.
990
990
  *
@@ -1297,7 +1297,7 @@ var MastraCloudAuthProvider = class extends MastraAuthProvider {
1297
1297
  */
1298
1298
  async createSession(userId, metadata) {
1299
1299
  const now = /* @__PURE__ */ new Date();
1300
- const expiresAt = new Date(now.getTime() + 1440 * 60 * 1e3);
1300
+ const expiresAt = new Date(now.getTime() + 864e5);
1301
1301
  return {
1302
1302
  id: metadata?.accessToken ?? crypto.randomUUID(),
1303
1303
  userId,