@mastra/auth-okta 0.2.5-alpha.0 → 0.2.6-alpha.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/dist/_types/@internal_auth/dist/_types/@internal_core/dist/base/index.d.ts +2 -5
- package/dist/_types/@internal_auth/dist/_types/@internal_core/dist/{index-Biaf3BmX.d.ts → index-TNVgGNjs.d.ts} +1 -5
- package/dist/_types/@internal_auth/dist/session/index.d.ts +9 -0
- package/dist/index.cjs +11 -19
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +11 -19
- package/dist/index.js.map +1 -1
- package/dist/rbac-provider.d.ts.map +1 -1
- package/package.json +12 -13
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { LRUCache } from "lru-cache";
|
|
2
2
|
import { createRemoteJWKSet, jwtVerify } from "jose";
|
|
3
|
-
|
|
3
|
+
// ../../packages/_internals/auth/dist/ee-CnZdF0Vm.js
|
|
4
4
|
/**
|
|
5
5
|
* FGA enforcement utility for checking fine-grained authorization.
|
|
6
6
|
*
|
|
@@ -109,10 +109,9 @@ function resolvePermissionsFromMapping(roles, mapping) {
|
|
|
109
109
|
* @license Mastra Enterprise License - see ee/LICENSE
|
|
110
110
|
* @packageDocumentation
|
|
111
111
|
*/
|
|
112
|
-
|
|
113
|
-
//#region src/rbac-provider.ts
|
|
112
|
+
// src/rbac-provider.ts
|
|
114
113
|
/** Default cache TTL in milliseconds (60 seconds) */
|
|
115
|
-
const DEFAULT_CACHE_TTL_MS =
|
|
114
|
+
const DEFAULT_CACHE_TTL_MS = 6e4;
|
|
116
115
|
/** Default max cache size (number of users) */
|
|
117
116
|
const DEFAULT_CACHE_MAX_SIZE = 1e3;
|
|
118
117
|
/** Page size for the Okta list-user-groups call (Okta max is 200) */
|
|
@@ -312,8 +311,7 @@ var MastraRBACOkta = class {
|
|
|
312
311
|
return permissions.some((required) => userPermissions.some((granted) => matchesPermission(granted, required)));
|
|
313
312
|
}
|
|
314
313
|
};
|
|
315
|
-
|
|
316
|
-
//#region ../../packages/_internals/auth/dist/types/index.js
|
|
314
|
+
// ../../packages/_internals/auth/dist/types/index.js
|
|
317
315
|
function headerFromPlainObject(headers, name) {
|
|
318
316
|
const normalizedName = name.toLowerCase();
|
|
319
317
|
const matchingKey = Object.keys(headers).find((key) => key.toLowerCase() === normalizedName);
|
|
@@ -333,8 +331,7 @@ function getRequestHeader(request, name) {
|
|
|
333
331
|
if (headers && typeof headers === "object") return headerFromPlainObject(headers, name);
|
|
334
332
|
return null;
|
|
335
333
|
}
|
|
336
|
-
|
|
337
|
-
//#region ../../packages/_internal-core/dist/logger/index.js
|
|
334
|
+
// ../../packages/_internal-core/dist/logger/index.js
|
|
338
335
|
/**
|
|
339
336
|
* Export a tracked exception through the adapter sink, mirroring the
|
|
340
337
|
* DualLogger dual-write shape (`errorId`/`domain`/`category`/`details`/`cause`
|
|
@@ -567,8 +564,7 @@ var ConsoleLogger = class ConsoleLogger extends MastraLogger {
|
|
|
567
564
|
};
|
|
568
565
|
}
|
|
569
566
|
};
|
|
570
|
-
|
|
571
|
-
//#region ../../packages/_internal-core/dist/base/index.js
|
|
567
|
+
// ../../packages/_internal-core/dist/base/index.js
|
|
572
568
|
var MastraBase = class {
|
|
573
569
|
component = RegisteredLogger.LLM;
|
|
574
570
|
logger;
|
|
@@ -602,8 +598,7 @@ var MastraBase = class {
|
|
|
602
598
|
this.logger = "child" in logger && typeof logger.child === "function" ? logger.child({ component: this.component }) : logger;
|
|
603
599
|
}
|
|
604
600
|
};
|
|
605
|
-
|
|
606
|
-
//#region ../../packages/_internals/auth/dist/provider/index.js
|
|
601
|
+
// ../../packages/_internals/auth/dist/provider/index.js
|
|
607
602
|
var MastraAuthProvider = class extends MastraBase {
|
|
608
603
|
protected;
|
|
609
604
|
public;
|
|
@@ -615,7 +610,7 @@ var MastraAuthProvider = class extends MastraBase {
|
|
|
615
610
|
if (options?.authorizeUser) this.authorizeUser = options.authorizeUser.bind(this);
|
|
616
611
|
this.protected = options?.protected;
|
|
617
612
|
this.public = options?.public;
|
|
618
|
-
this.mapUserToResourceId = options
|
|
613
|
+
if (options?.mapUserToResourceId) this.mapUserToResourceId = options.mapUserToResourceId;
|
|
619
614
|
}
|
|
620
615
|
registerOptions(opts) {
|
|
621
616
|
if (opts?.authorizeUser) this.authorizeUser = opts.authorizeUser.bind(this);
|
|
@@ -624,8 +619,7 @@ var MastraAuthProvider = class extends MastraBase {
|
|
|
624
619
|
if (opts?.public) this.public = opts.public;
|
|
625
620
|
}
|
|
626
621
|
};
|
|
627
|
-
|
|
628
|
-
//#region src/types.ts
|
|
622
|
+
// src/types.ts
|
|
629
623
|
/**
|
|
630
624
|
* Maps Okta JWT claims to OktaUser format.
|
|
631
625
|
*
|
|
@@ -647,8 +641,7 @@ function mapOktaClaimsToUser(payload) {
|
|
|
647
641
|
}
|
|
648
642
|
};
|
|
649
643
|
}
|
|
650
|
-
|
|
651
|
-
//#region src/auth-provider.ts
|
|
644
|
+
// src/auth-provider.ts
|
|
652
645
|
/**
|
|
653
646
|
* Trim trailing slashes. Index scan instead of regex to avoid backtracking
|
|
654
647
|
* (CodeQL js/polynomial-redos).
|
|
@@ -892,7 +885,7 @@ var MastraAuthOkta = class extends MastraAuthProvider {
|
|
|
892
885
|
const stateId = state.includes("|") ? state.split("|")[0] : state;
|
|
893
886
|
const actualRedirectUri = redirectUri ?? this.redirectUri;
|
|
894
887
|
stateStore.set(stateId, {
|
|
895
|
-
expiresAt: Date.now() +
|
|
888
|
+
expiresAt: Date.now() + 6e5,
|
|
896
889
|
redirectUri: actualRedirectUri
|
|
897
890
|
});
|
|
898
891
|
for (const [key, value] of stateStore.entries()) if (value.expiresAt < Date.now()) stateStore.delete(key);
|
|
@@ -1041,7 +1034,6 @@ var MastraAuthOkta = class extends MastraAuthProvider {
|
|
|
1041
1034
|
return this.issuer;
|
|
1042
1035
|
}
|
|
1043
1036
|
};
|
|
1044
|
-
//#endregion
|
|
1045
1037
|
export { MastraAuthOkta, MastraRBACOkta, mapOktaClaimsToUser };
|
|
1046
1038
|
|
|
1047
1039
|
//# sourceMappingURL=index.js.map
|