@better-auth/sso 1.7.19 → 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
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as PACKAGE_VERSION } from "./version-
|
|
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") !==
|
|
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:
|
|
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
|
|
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
|
|
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 {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@better-auth/sso",
|
|
3
|
-
"version": "1.7.
|
|
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/core": "1.7.
|
|
76
|
-
"@better-auth/kysely-adapter": "1.7.
|
|
77
|
-
"better-auth": "1.7.
|
|
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.
|
|
84
|
-
"better-auth": "^1.7.
|
|
83
|
+
"@better-auth/core": "^1.7.20",
|
|
84
|
+
"better-auth": "^1.7.20"
|
|
85
85
|
},
|
|
86
86
|
"scripts": {
|
|
87
87
|
"build": "tsdown",
|