@better-auth/sso 1.7.18 → 1.7.20

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/client.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { t as PACKAGE_VERSION } from "./version-BabgsTE7.mjs";
1
+ import { t as PACKAGE_VERSION } from "./version-COmqWYke.mjs";
2
2
  //#region src/client.ts
3
3
  const ssoClient = (options) => {
4
4
  return {
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { t as PACKAGE_VERSION } from "./version-BabgsTE7.mjs";
1
+ import { t as PACKAGE_VERSION } from "./version-COmqWYke.mjs";
2
2
  import { APIError, addOAuthServerContext, createAuthEndpoint, createAuthMiddleware, getSessionFromCtx, sessionMiddleware } from "better-auth/api";
3
3
  import { XMLParser, XMLValidator } from "fast-xml-parser";
4
4
  import { X509Certificate } from "node:crypto";
@@ -1383,7 +1383,7 @@ function parseSAMLServiceProviderMetadata(metadata) {
1383
1383
  if (value) nameIDFormats.push(value);
1384
1384
  }
1385
1385
  for (const service of directMetadataChildren(descriptor, "AssertionConsumerService")) {
1386
- if (service.getAttribute("Binding") !== "urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST") continue;
1386
+ if (service.getAttribute("Binding") !== SAML_HTTP_POST_BINDING) continue;
1387
1387
  const location = service.getAttribute("Location")?.trim();
1388
1388
  if (!location || !isAbsoluteHttpUrl(location)) throw new Error("Invalid SAML POST AssertionConsumerService");
1389
1389
  postAssertionConsumerServiceUrls.push(location);
@@ -1693,6 +1693,7 @@ async function findSAMLProvider(providerId, options, adapter) {
1693
1693
  }
1694
1694
  function createSP(config, baseURL, providerId, opts) {
1695
1695
  const spData = config.spMetadata;
1696
+ const clockSkew = opts?.clockSkew ?? 3e5;
1696
1697
  const sloLocation = `${baseURL}/sso/saml2/sp/slo/${providerId}`;
1697
1698
  const acsUrl = `${baseURL}/sso/saml2/sp/acs/${providerId}`;
1698
1699
  let metadata = spData?.metadata;
@@ -1725,7 +1726,7 @@ function createSP(config, baseURL, providerId, opts) {
1725
1726
  encPrivateKey: normalizePem(spData?.encPrivateKey),
1726
1727
  encPrivateKeyPass: spData?.encPrivateKeyPass,
1727
1728
  relayState: opts?.relayState,
1728
- clockDrifts: opts?.clockSkew && opts?.clockSkew !== 0 ? [-opts.clockSkew, opts.clockSkew] : void 0
1729
+ clockDrifts: [-clockSkew, clockSkew]
1729
1730
  });
1730
1731
  }
1731
1732
  /**
@@ -2806,17 +2807,12 @@ function getSAMLRedirectCandidates(relayStateCallbackUrl, samlConfig, samlOption
2806
2807
  samlConfig?.callbackUrl
2807
2808
  ];
2808
2809
  }
2809
- function toArray(value) {
2810
- if (Array.isArray(value)) return value;
2811
- return value ? [value] : [];
2812
- }
2813
- function getExpectedSAMLRecipients(config, baseURL, providerId, currentCallbackPath, assertionConsumerServiceUrl) {
2810
+ function getExpectedSAMLRecipients(config, baseURL, providerId, currentCallbackPath) {
2814
2811
  const configuredPostAssertionConsumerServiceUrls = getSAMLPostAssertionConsumerServiceUrls(config.spMetadata?.metadata);
2815
2812
  return [
2816
2813
  currentCallbackPath,
2817
2814
  `${baseURL}/sso/saml2/sp/acs/${providerId}`,
2818
- ...configuredPostAssertionConsumerServiceUrls,
2819
- ...toArray(assertionConsumerServiceUrl)
2815
+ ...configuredPostAssertionConsumerServiceUrls
2820
2816
  ];
2821
2817
  }
2822
2818
  async function getSAMLResponseBindingContent(sp, samlContent) {
@@ -2899,8 +2895,7 @@ async function processSAMLResponse(ctx, params, options) {
2899
2895
  logger: ctx.context.logger
2900
2896
  });
2901
2897
  const expectedAudiences = [sp.entityMeta.getEntityID(), parsedSamlConfig.audience];
2902
- const assertionConsumerServiceUrl = sp.entityMeta.getAssertionConsumerService(SAML_HTTP_POST_BINDING);
2903
- const expectedRecipients = getExpectedSAMLRecipients(parsedSamlConfig, ctx.context.baseURL, providerId, currentCallbackPath, assertionConsumerServiceUrl);
2898
+ const expectedRecipients = getExpectedSAMLRecipients(parsedSamlConfig, ctx.context.baseURL, providerId, currentCallbackPath);
2904
2899
  const serviceProviderPolicy = deriveSAMLServiceProviderPolicy(parsedSamlConfig);
2905
2900
  let samlBindingContent;
2906
2901
  try {
@@ -1,5 +1,5 @@
1
1
  //#endregion
2
2
  //#region src/version.ts
3
- const PACKAGE_VERSION = "1.7.18";
3
+ const PACKAGE_VERSION = "1.7.20";
4
4
  //#endregion
5
5
  export { PACKAGE_VERSION as t };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@better-auth/sso",
3
- "version": "1.7.18",
3
+ "version": "1.7.20",
4
4
  "description": "SSO plugin for Better Auth",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -72,16 +72,16 @@
72
72
  "kysely": "^0.28.17 || ^0.29.0",
73
73
  "oauth2-mock-server": "^9.0.0",
74
74
  "tsdown": "0.23.1",
75
- "@better-auth/kysely-adapter": "1.7.18",
76
- "better-auth": "1.7.18",
77
- "@better-auth/core": "1.7.18"
75
+ "@better-auth/core": "1.7.20",
76
+ "@better-auth/kysely-adapter": "1.7.20",
77
+ "better-auth": "1.7.20"
78
78
  },
79
79
  "peerDependencies": {
80
80
  "@better-auth/utils": "^0.4.2 || ^0.5.0",
81
81
  "@better-fetch/fetch": "1.3.3",
82
82
  "better-call": "1.4.5",
83
- "@better-auth/core": "^1.7.18",
84
- "better-auth": "^1.7.18"
83
+ "@better-auth/core": "^1.7.20",
84
+ "better-auth": "^1.7.20"
85
85
  },
86
86
  "scripts": {
87
87
  "build": "tsdown",