@absolutejs/auth 0.53.2 → 0.53.4

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.
@@ -338,6 +338,20 @@ var providers = defineProviders({
338
338
  url: "https://developer.api.autodesk.com/authentication/v2/token"
339
339
  }
340
340
  },
341
+ azureadb2c: {
342
+ authorizationUrl: (config) => `https://${config.tenantSubdomain}.b2clogin.com/${config.tenantSubdomain}.onmicrosoft.com/${config.policy}/oauth2/v2.0/authorize`,
343
+ isOIDC: true,
344
+ isRefreshable: true,
345
+ PKCEMethod: "S256",
346
+ scopeRequired: false,
347
+ subject: ["sub"],
348
+ subjectType: "string",
349
+ tokenRequest: {
350
+ authIn: "body",
351
+ encoding: "application/x-www-form-urlencoded",
352
+ url: (config) => `https://${config.tenantSubdomain}.b2clogin.com/${config.tenantSubdomain}.onmicrosoft.com/${config.policy}/oauth2/v2.0/token`
353
+ }
354
+ },
341
355
  battlenet: {
342
356
  authorizationUrl: "https://oauth.battle.net/authorize",
343
357
  isOIDC: true,
@@ -1076,6 +1090,20 @@ var providers = defineProviders({
1076
1090
  url: "https://api.mercadopago.com/oauth/token"
1077
1091
  }
1078
1092
  },
1093
+ microsoftentraexternalid: {
1094
+ authorizationUrl: (config) => `https://${config.tenantSubdomain}.ciamlogin.com/${config.tenantId}/oauth2/v2.0/authorize`,
1095
+ isOIDC: true,
1096
+ isRefreshable: true,
1097
+ PKCEMethod: "S256",
1098
+ scopeRequired: false,
1099
+ subject: ["sub"],
1100
+ subjectType: "string",
1101
+ tokenRequest: {
1102
+ authIn: "body",
1103
+ encoding: "application/x-www-form-urlencoded",
1104
+ url: (config) => `https://${config.tenantSubdomain}.ciamlogin.com/${config.tenantId}/oauth2/v2.0/token`
1105
+ }
1106
+ },
1079
1107
  microsoftentraid: {
1080
1108
  authorizationUrl: (config) => `https://login.microsoftonline.com/${config.tenantId}/oauth2/v2.0/authorize`,
1081
1109
  isOIDC: true,
@@ -2109,10 +2137,7 @@ var getWithingsProps = async (config) => {
2109
2137
  nonceUrl.searchParams.set("timestamp", timestamp.toString());
2110
2138
  nonceUrl.searchParams.set("signature", hashedSignature);
2111
2139
  const nonceTarget = nonceUrl.toString();
2112
- const nonceResponse = await fetch(nonceTarget, {
2113
- ...h2IfHttps(nonceTarget),
2114
- method: "POST"
2115
- });
2140
+ const nonceResponse = await fetch(nonceTarget, { method: "POST" });
2116
2141
  const nonceData = await nonceResponse.json();
2117
2142
  if (nonceData.status === 0) {
2118
2143
  return {
@@ -2122,10 +2147,6 @@ var getWithingsProps = async (config) => {
2122
2147
  }
2123
2148
  return;
2124
2149
  };
2125
- var h2IfHttps = (url) => {
2126
- const init = url.startsWith("https://") ? { protocol: "http2" } : {};
2127
- return init;
2128
- };
2129
2150
  var hmacSha256 = async (message, secret) => {
2130
2151
  const encoder = new TextEncoder;
2131
2152
  const key = await crypto.subtle.importKey("raw", encoder.encode(secret), { hash: "SHA-256", name: "HMAC" }, false, ["sign"]);
@@ -2462,6 +2483,9 @@ var buildOAuth2Client = async (meta, config) => {
2462
2483
  },
2463
2484
  async fetchUserProfile(accessToken) {
2464
2485
  const { profileRequest } = meta;
2486
+ if (!profileRequest) {
2487
+ throw new Error("OIDC provider exposes identity through the id_token and does not define a UserInfo endpoint");
2488
+ }
2465
2489
  const {
2466
2490
  url,
2467
2491
  method,
@@ -2496,10 +2520,7 @@ var buildOAuth2Client = async (meta, config) => {
2496
2520
  init.body = encoding === "application/json" ? JSON.stringify(resolvedBody) : new URLSearchParams(resolvedBody).toString();
2497
2521
  }
2498
2522
  const profileTarget = endpoint.toString();
2499
- const response = await fetch(profileTarget, {
2500
- ...h2IfHttps(profileTarget),
2501
- ...init
2502
- });
2523
+ const response = await fetch(profileTarget, init);
2503
2524
  if (!response.ok)
2504
2525
  throw await createOAuth2FetchError(response);
2505
2526
  return response.json();
@@ -2524,9 +2545,7 @@ var buildOAuth2Client = async (meta, config) => {
2524
2545
  encoding,
2525
2546
  url: tokenUrl
2526
2547
  });
2527
- const response = await fetch(request, {
2528
- ...h2IfHttps(request.url)
2529
- });
2548
+ const response = await fetch(request);
2530
2549
  if (!response.ok)
2531
2550
  throw await createOAuth2FetchError(response);
2532
2551
  return response.json();
@@ -2580,9 +2599,7 @@ var buildOAuth2Client = async (meta, config) => {
2580
2599
  url: `${endpoint.toString()}?${tokenParamName}=${token}`
2581
2600
  });
2582
2601
  }
2583
- const response = await fetch(request, {
2584
- ...h2IfHttps(request.url)
2585
- });
2602
+ const response = await fetch(request);
2586
2603
  if (!response.ok)
2587
2604
  throw await createOAuth2FetchError(response);
2588
2605
  },
@@ -2614,9 +2631,7 @@ var buildOAuth2Client = async (meta, config) => {
2614
2631
  encoding,
2615
2632
  url: tokenUrl
2616
2633
  });
2617
- const response = await fetch(request, {
2618
- ...h2IfHttps(request.url)
2619
- });
2634
+ const response = await fetch(request);
2620
2635
  if (!response.ok)
2621
2636
  throw await createOAuth2FetchError(response);
2622
2637
  const tokenResponse = await response.json();
@@ -2716,5 +2731,5 @@ export {
2716
2731
  escapeHtml
2717
2732
  };
2718
2733
 
2719
- //# debugId=2CB3119B4750600064756E2164756E21
2734
+ //# debugId=8A3717C6B386FCBD64756E2164756E21
2720
2735
  //# sourceMappingURL=index.js.map