@absolutejs/auth 0.53.0 → 0.53.2

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 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
@@ -1212,7 +1212,7 @@ var providers = defineProviders({
1212
1212
  }
1213
1213
  },
1214
1214
  microsoftentraid: {
1215
- authorizationUrl: (config) => `https://${config.tenantId}.b2clogin.com/${config.tenantId}/oauth2/v2.0/authorize`,
1215
+ authorizationUrl: (config) => `https://login.microsoftonline.com/${config.tenantId}/oauth2/v2.0/authorize`,
1216
1216
  isOIDC: true,
1217
1217
  isRefreshable: true,
1218
1218
  PKCEMethod: "S256",
@@ -1220,15 +1220,15 @@ var providers = defineProviders({
1220
1220
  authIn: "header",
1221
1221
  encoding: "application/json",
1222
1222
  method: "GET",
1223
- url: (config) => `https://${config.tenantId}.b2clogin.com/${config.tenantId}/openid/userinfo`
1223
+ url: "https://graph.microsoft.com/oidc/userinfo"
1224
1224
  },
1225
1225
  scopeRequired: false,
1226
- subject: ["id"],
1226
+ subject: ["sub"],
1227
1227
  subjectType: "string",
1228
1228
  tokenRequest: {
1229
1229
  authIn: "body",
1230
1230
  encoding: "application/x-www-form-urlencoded",
1231
- url: (config) => `https://${config.tenantId}.b2clogin.com/${config.tenantId}/oauth2/v2.0/token`
1231
+ url: (config) => `https://login.microsoftonline.com/${config.tenantId}/oauth2/v2.0/token`
1232
1232
  }
1233
1233
  },
1234
1234
  monday: {
@@ -1349,7 +1349,7 @@ var providers = defineProviders({
1349
1349
  }
1350
1350
  },
1351
1351
  onspark: {
1352
- authorizationUrl: "https://app.onspark.com/oauth2/authorize",
1352
+ authorizationUrl: "https://onspark.com/oauth2/authorize",
1353
1353
  email: ["email"],
1354
1354
  familyName: ["family_name"],
1355
1355
  fullName: ["name"],
@@ -1362,13 +1362,13 @@ var providers = defineProviders({
1362
1362
  authIn: "header",
1363
1363
  encoding: "application/json",
1364
1364
  method: "GET",
1365
- url: "https://app.onspark.com/oauth2/userinfo"
1365
+ url: "https://onspark.com/oauth2/userinfo"
1366
1366
  },
1367
1367
  revocationRequest: {
1368
1368
  authIn: "body",
1369
1369
  encoding: "application/x-www-form-urlencoded",
1370
1370
  tokenParamName: "token",
1371
- url: "https://app.onspark.com/oauth2/revoke"
1371
+ url: "https://onspark.com/oauth2/revoke"
1372
1372
  },
1373
1373
  scopeRequired: true,
1374
1374
  subject: ["sub"],
@@ -1376,7 +1376,7 @@ var providers = defineProviders({
1376
1376
  tokenRequest: {
1377
1377
  authIn: "body",
1378
1378
  encoding: "application/x-www-form-urlencoded",
1379
- url: "https://app.onspark.com/oauth2/token"
1379
+ url: "https://onspark.com/oauth2/token"
1380
1380
  }
1381
1381
  },
1382
1382
  osu: {
@@ -22189,6 +22189,21 @@ var createNeonAuthSessionStore = (databaseUrl) => {
22189
22189
  }
22190
22190
  };
22191
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
+ };
22192
22207
  // src/session/redisStore.ts
22193
22208
  var SESSION_SEGMENT = "sess:";
22194
22209
  var UNREGISTERED_SEGMENT = "unreg:";
@@ -27714,6 +27729,7 @@ export {
27714
27729
  readSessionRing,
27715
27730
  pushAuthorizationRequest,
27716
27731
  pruneInactiveUsers,
27732
+ providersFromEnv,
27717
27733
  providers,
27718
27734
  providerOptions,
27719
27735
  protectRoutePlugin,
@@ -28059,5 +28075,5 @@ export {
28059
28075
  AuthIdentityConflictError
28060
28076
  };
28061
28077
 
28062
- //# debugId=1AA6ADB109ED877964756E2164756E21
28078
+ //# debugId=610457B3BCB89FDE64756E2164756E21
28063
28079
  //# sourceMappingURL=index.js.map