@camstack/core 0.1.20 → 0.1.21
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/auth/auth-manager.d.ts +1 -16
- package/dist/auth/auth-manager.d.ts.map +1 -1
- package/dist/builtins/local-auth/local-auth.addon.d.ts.map +1 -1
- package/dist/builtins/local-auth/local-auth.addon.js +1 -23
- package/dist/builtins/local-auth/local-auth.addon.js.map +1 -1
- package/dist/builtins/local-auth/local-auth.addon.mjs +1 -23
- package/dist/builtins/local-auth/local-auth.addon.mjs.map +1 -1
- package/dist/index.js +4 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +4 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -6161,7 +6161,6 @@ var noopLogger = {
|
|
|
6161
6161
|
};
|
|
6162
6162
|
var AuthManager = class {
|
|
6163
6163
|
jwtSecret;
|
|
6164
|
-
scopedTokenManager = null;
|
|
6165
6164
|
logger;
|
|
6166
6165
|
constructor(config, logger = noopLogger) {
|
|
6167
6166
|
this.config = config;
|
|
@@ -6215,27 +6214,6 @@ var AuthManager = class {
|
|
|
6215
6214
|
const expiresIn = opts.expiresIn ?? "24h";
|
|
6216
6215
|
return import_jsonwebtoken.sign(payload, this.jwtSecret, { expiresIn });
|
|
6217
6216
|
}
|
|
6218
|
-
/**
|
|
6219
|
-
* Set the scoped token manager for the auth chain.
|
|
6220
|
-
*/
|
|
6221
|
-
setScopedTokenManager(manager) {
|
|
6222
|
-
this.scopedTokenManager = manager;
|
|
6223
|
-
}
|
|
6224
|
-
/**
|
|
6225
|
-
* Validate a scoped token string.
|
|
6226
|
-
* Returns the token record if valid, null otherwise.
|
|
6227
|
-
*/
|
|
6228
|
-
async validateScopedToken(rawToken) {
|
|
6229
|
-
if (!this.scopedTokenManager) return null;
|
|
6230
|
-
return this.scopedTokenManager.validate(rawToken);
|
|
6231
|
-
}
|
|
6232
|
-
/**
|
|
6233
|
-
* Check whether a scoped token grants access to a given addon/route/capability.
|
|
6234
|
-
*/
|
|
6235
|
-
matchesScopedTokenScope(token, addonId, routePath, capability) {
|
|
6236
|
-
if (!this.scopedTokenManager) return false;
|
|
6237
|
-
return this.scopedTokenManager.matchesScope(token, addonId, routePath, capability);
|
|
6238
|
-
}
|
|
6239
6217
|
};
|
|
6240
6218
|
//#endregion
|
|
6241
6219
|
//#region src/auth/parse-record.ts
|
|
@@ -6843,7 +6821,7 @@ var LocalAuthAddon = class extends BaseAddon {
|
|
|
6843
6821
|
},
|
|
6844
6822
|
createScopedToken: async (input) => {
|
|
6845
6823
|
if (!this.scopedTokenManager) throw new Error("Scoped token management not available");
|
|
6846
|
-
const { token, record } = await this.scopedTokenManager.create(
|
|
6824
|
+
const { token, record } = await this.scopedTokenManager.create(input.userId, input.name, input.scopes, input.expiresAt);
|
|
6847
6825
|
return {
|
|
6848
6826
|
token,
|
|
6849
6827
|
record
|