@absolutejs/auth 0.52.1 → 0.53.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/index.d.ts +1 -0
- package/dist/index.js +24 -3
- package/dist/index.js.map +6 -5
- package/dist/manifest.d.ts +2 -0
- package/dist/manifest.js +8722 -0
- package/dist/manifest.js.map +123 -0
- package/dist/manifest.json +329 -0
- package/dist/oidc/config.d.ts +3 -1
- package/dist/providersFromEnv.d.ts +19 -0
- package/package.json +16 -5
package/dist/index.d.ts
CHANGED
|
@@ -107,6 +107,7 @@ export { AuthIdentityConflictError } from './errors';
|
|
|
107
107
|
export { sessionStore } from './session/state';
|
|
108
108
|
export { createInMemoryAuthSessionStore } from './session/inMemoryStore';
|
|
109
109
|
export { createNeonAuthSessionStore } from './session/neonStore';
|
|
110
|
+
export { providersFromEnv, type ProviderSelection } from './providersFromEnv';
|
|
110
111
|
export { createRedisAuthSessionStore, type RedisSessionClient } from './session/redisStore';
|
|
111
112
|
export { createLinkedProviderCredentialResolver } from './linkedProviders/resolver';
|
|
112
113
|
export { createOAuthLinkedProviderCredentialResolver } from './linkedProviders/oauthResolver';
|
package/dist/index.js
CHANGED
|
@@ -4868,6 +4868,11 @@ var REFRESH_TTL_DAYS = 30;
|
|
|
4868
4868
|
var DEFAULT_ACCESS_TOKEN_TTL_MS2 = MILLISECONDS_IN_AN_HOUR;
|
|
4869
4869
|
var DEFAULT_ID_TOKEN_TTL_MS = MILLISECONDS_IN_AN_HOUR;
|
|
4870
4870
|
var DEFAULT_REFRESH_TOKEN_TTL_MS = MILLISECONDS_IN_A_DAY * REFRESH_TTL_DAYS;
|
|
4871
|
+
var resolveAccessTtl = (ttl, scopes) => {
|
|
4872
|
+
if (typeof ttl === "function")
|
|
4873
|
+
return ttl({ scopes });
|
|
4874
|
+
return ttl ?? DEFAULT_ACCESS_TOKEN_TTL_MS2;
|
|
4875
|
+
};
|
|
4871
4876
|
var nowSeconds = (milliseconds) => Math.floor(milliseconds / MS_PER_SECOND);
|
|
4872
4877
|
var narrowScopes = (available, requested) => requested === undefined || requested.length === 0 ? available : requested.filter((scope) => available.includes(scope));
|
|
4873
4878
|
var RESERVED_ACCESS_CLAIMS = new Set([
|
|
@@ -4941,7 +4946,7 @@ var exchangeToken = async ({
|
|
|
4941
4946
|
return { error: "invalid_scope", ok: false };
|
|
4942
4947
|
}
|
|
4943
4948
|
const scopes = narrowScopes(available, requestedScopes);
|
|
4944
|
-
const ttl = config.accessTokenTtlMs
|
|
4949
|
+
const ttl = resolveAccessTtl(config.accessTokenTtlMs, scopes);
|
|
4945
4950
|
const extraClaims = await config.getAccessTokenClaims?.({
|
|
4946
4951
|
audience,
|
|
4947
4952
|
clientId: actorClientId,
|
|
@@ -4978,7 +4983,7 @@ var issueTokenSet = async ({
|
|
|
4978
4983
|
scopes,
|
|
4979
4984
|
sub
|
|
4980
4985
|
}) => {
|
|
4981
|
-
const accessTtl = config.accessTokenTtlMs
|
|
4986
|
+
const accessTtl = resolveAccessTtl(config.accessTokenTtlMs, scopes);
|
|
4982
4987
|
const idTtl = config.idTokenTtlMs ?? DEFAULT_ID_TOKEN_TTL_MS;
|
|
4983
4988
|
const refreshTtl = config.refreshTokenTtlMs ?? DEFAULT_REFRESH_TOKEN_TTL_MS;
|
|
4984
4989
|
const accessExtra = await config.getAccessTokenClaims?.({
|
|
@@ -22184,6 +22189,21 @@ var createNeonAuthSessionStore = (databaseUrl) => {
|
|
|
22184
22189
|
}
|
|
22185
22190
|
};
|
|
22186
22191
|
};
|
|
22192
|
+
// src/providersFromEnv.ts
|
|
22193
|
+
var envKey = (provider, suffix) => `${provider.replace(/[^a-zA-Z0-9]/g, "_").toUpperCase()}_${suffix}`;
|
|
22194
|
+
var providersFromEnv = (selection, env = process.env) => {
|
|
22195
|
+
const configured = Object.fromEntries(Object.entries(selection).map(([provider, options]) => [
|
|
22196
|
+
provider,
|
|
22197
|
+
{
|
|
22198
|
+
...options,
|
|
22199
|
+
credentials: {
|
|
22200
|
+
clientId: env[envKey(provider, "CLIENT_ID")] ?? "",
|
|
22201
|
+
clientSecret: env[envKey(provider, "CLIENT_SECRET")] ?? ""
|
|
22202
|
+
}
|
|
22203
|
+
}
|
|
22204
|
+
]));
|
|
22205
|
+
return configured;
|
|
22206
|
+
};
|
|
22187
22207
|
// src/session/redisStore.ts
|
|
22188
22208
|
var SESSION_SEGMENT = "sess:";
|
|
22189
22209
|
var UNREGISTERED_SEGMENT = "unreg:";
|
|
@@ -27709,6 +27729,7 @@ export {
|
|
|
27709
27729
|
readSessionRing,
|
|
27710
27730
|
pushAuthorizationRequest,
|
|
27711
27731
|
pruneInactiveUsers,
|
|
27732
|
+
providersFromEnv,
|
|
27712
27733
|
providers,
|
|
27713
27734
|
providerOptions,
|
|
27714
27735
|
protectRoutePlugin,
|
|
@@ -28054,5 +28075,5 @@ export {
|
|
|
28054
28075
|
AuthIdentityConflictError
|
|
28055
28076
|
};
|
|
28056
28077
|
|
|
28057
|
-
//# debugId=
|
|
28078
|
+
//# debugId=02EB747B81877D6664756E2164756E21
|
|
28058
28079
|
//# sourceMappingURL=index.js.map
|