@absolutejs/auth 0.50.0 → 0.52.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.
@@ -127,6 +127,7 @@ var anilistProfileQuery = `query {
127
127
  }
128
128
  }`;
129
129
  var defineProviders = (providers) => providers;
130
+ var defineProvider = (config) => config;
130
131
  var providers = defineProviders({
131
132
  "42": {
132
133
  authorizationUrl: "https://api.intra.42.fr/oauth/authorize",
@@ -1212,6 +1213,37 @@ var providers = defineProviders({
1212
1213
  url: (config) => `https://${config.domain}/oauth2/default/v1/token`
1213
1214
  }
1214
1215
  },
1216
+ onspark: {
1217
+ authorizationUrl: "https://app.onspark.com/oauth2/authorize",
1218
+ email: ["email"],
1219
+ familyName: ["family_name"],
1220
+ fullName: ["name"],
1221
+ givenName: ["given_name"],
1222
+ isOIDC: true,
1223
+ isRefreshable: true,
1224
+ picture: ["picture"],
1225
+ PKCEMethod: "S256",
1226
+ profileRequest: {
1227
+ authIn: "header",
1228
+ encoding: "application/json",
1229
+ method: "GET",
1230
+ url: "https://app.onspark.com/oauth2/userinfo"
1231
+ },
1232
+ revocationRequest: {
1233
+ authIn: "body",
1234
+ encoding: "application/x-www-form-urlencoded",
1235
+ tokenParamName: "token",
1236
+ url: "https://app.onspark.com/oauth2/revoke"
1237
+ },
1238
+ scopeRequired: true,
1239
+ subject: ["sub"],
1240
+ subjectType: "string",
1241
+ tokenRequest: {
1242
+ authIn: "body",
1243
+ encoding: "application/x-www-form-urlencoded",
1244
+ url: "https://app.onspark.com/oauth2/token"
1245
+ }
1246
+ },
1215
1247
  osu: {
1216
1248
  authorizationUrl: "https://osu.ppy.sh/oauth/authorize",
1217
1249
  isOIDC: false,
@@ -1763,6 +1795,7 @@ var providers = defineProviders({
1763
1795
  method: "POST",
1764
1796
  url: "https://wbsapi.withings.net/v2/oauth2"
1765
1797
  },
1798
+ scopeDelimiter: ",",
1766
1799
  scopeRequired: true,
1767
1800
  subject: ["userid"],
1768
1801
  subjectType: "string",
@@ -2394,8 +2427,7 @@ var refreshableProviderOptions = Object.keys(providers).filter(isRefreshableProv
2394
2427
  var revocableProviderOptions = Object.keys(providers).filter(isRevocableProviderOption);
2395
2428
  var scopeRequiredProviderOptions = Object.keys(providers).filter(isScopeRequiredProviderOption);
2396
2429
  var readPath = (value, path) => path.reduce((cursor, key) => cursor && typeof cursor === "object" ? Reflect.get(cursor, key) : undefined, value);
2397
- var createOAuth2Client = async (providerName, config) => {
2398
- const meta = providers[providerName];
2430
+ var buildOAuth2Client = async (meta, config) => {
2399
2431
  const isConfigPropertyFunction = (cfgProp) => typeof cfgProp === "function";
2400
2432
  const resolveConfigProp = async (cfgProp) => {
2401
2433
  const result = isConfigPropertyFunction(cfgProp) ? cfgProp(config) : cfgProp;
@@ -2414,8 +2446,7 @@ var createOAuth2Client = async (providerName, config) => {
2414
2446
  if (state)
2415
2447
  url.searchParams.set("state", state);
2416
2448
  if (scope.length !== 0) {
2417
- const delimeter = providerName === "withings" ? "," : " ";
2418
- url.searchParams.set(meta.scopeParamName ?? "scope", scope.join(delimeter));
2449
+ url.searchParams.set(meta.scopeParamName ?? "scope", scope.join(meta.scopeDelimiter ?? " "));
2419
2450
  }
2420
2451
  if (meta.PKCEMethod !== undefined) {
2421
2452
  if (!codeVerifier) {
@@ -2597,6 +2628,8 @@ var createOAuth2Client = async (providerName, config) => {
2597
2628
  }
2598
2629
  };
2599
2630
  };
2631
+ var createCustomOAuth2Client = (providerConfig, credentials) => buildOAuth2Client(providerConfig, credentials);
2632
+ var createOAuth2Client = (providerName, config) => buildOAuth2Client(providers[providerName], config);
2600
2633
 
2601
2634
  // src/htmx/renderers.ts
2602
2635
  var escapeHtml = (value) => value.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;").replaceAll('"', "&quot;");
@@ -2683,5 +2716,5 @@ export {
2683
2716
  escapeHtml
2684
2717
  };
2685
2718
 
2686
- //# debugId=1439BB73F13E4F7864756E2164756E21
2719
+ //# debugId=8C096C6BDB713BD964756E2164756E21
2687
2720
  //# sourceMappingURL=index.js.map