@better-auth/sso 1.7.0-beta.1 → 1.7.0-beta.3
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,7 +1,6 @@
|
|
|
1
|
-
import { t as PACKAGE_VERSION } from "./version-
|
|
1
|
+
import { t as PACKAGE_VERSION } from "./version-CLqkeI3u.mjs";
|
|
2
2
|
import { APIError, createAuthEndpoint, createAuthMiddleware, getSessionFromCtx, sessionMiddleware } from "better-auth/api";
|
|
3
3
|
import { XMLParser, XMLValidator } from "fast-xml-parser";
|
|
4
|
-
import * as saml from "samlify";
|
|
5
4
|
import { X509Certificate } from "node:crypto";
|
|
6
5
|
import { getHostname } from "tldts";
|
|
7
6
|
import { generateRandomString } from "better-auth/crypto";
|
|
@@ -13,6 +12,8 @@ import { deleteSessionCookie, setSessionCookie } from "better-auth/cookies";
|
|
|
13
12
|
import { handleOAuthUserInfo } from "better-auth/oauth2";
|
|
14
13
|
import { decodeJwt } from "jose";
|
|
15
14
|
import { defineErrorCodes } from "@better-auth/core/utils/error-codes";
|
|
15
|
+
import * as samlifyNamespace from "samlify";
|
|
16
|
+
import samlifyDefault from "samlify";
|
|
16
17
|
//#region src/constants.ts
|
|
17
18
|
/**
|
|
18
19
|
* SAML Constants
|
|
@@ -1506,6 +1507,7 @@ async function parseRelayState(c) {
|
|
|
1506
1507
|
if (!parsedData.errorURL) parsedData.errorURL = errorURL;
|
|
1507
1508
|
return parsedData;
|
|
1508
1509
|
}
|
|
1510
|
+
const saml = typeof samlifyNamespace.SPMetadata === "function" && typeof samlifyNamespace.setSchemaValidator === "function" ? samlifyNamespace : samlifyDefault ?? samlifyNamespace;
|
|
1509
1511
|
//#endregion
|
|
1510
1512
|
//#region src/routes/helpers.ts
|
|
1511
1513
|
/**
|
|
@@ -1918,15 +1920,9 @@ const spMetadata = (options) => {
|
|
|
1918
1920
|
responses: { "200": { description: "SAML metadata in XML format" } }
|
|
1919
1921
|
} }
|
|
1920
1922
|
}, async (ctx) => {
|
|
1921
|
-
const provider = await ctx.context.adapter
|
|
1922
|
-
model: "ssoProvider",
|
|
1923
|
-
where: [{
|
|
1924
|
-
field: "providerId",
|
|
1925
|
-
value: ctx.query.providerId
|
|
1926
|
-
}]
|
|
1927
|
-
});
|
|
1923
|
+
const provider = await findSAMLProvider(ctx.query.providerId, options, ctx.context.adapter);
|
|
1928
1924
|
if (!provider) throw new APIError("NOT_FOUND", { message: "No provider found for the given providerId" });
|
|
1929
|
-
const parsedSamlConfig =
|
|
1925
|
+
const parsedSamlConfig = provider.samlConfig;
|
|
1930
1926
|
if (!parsedSamlConfig) throw new APIError("BAD_REQUEST", { message: "Invalid SAML configuration" });
|
|
1931
1927
|
const sp = createSP(parsedSamlConfig, ctx.context.baseURL, ctx.query.providerId, options?.saml?.enableSingleLogout ? { sloOptions: {
|
|
1932
1928
|
wantLogoutRequestSigned: options?.saml?.wantLogoutRequestSigned,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@better-auth/sso",
|
|
3
|
-
"version": "1.7.0-beta.
|
|
3
|
+
"version": "1.7.0-beta.3",
|
|
4
4
|
"description": "SSO plugin for Better Auth",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -70,15 +70,15 @@
|
|
|
70
70
|
"express": "^5.2.1",
|
|
71
71
|
"oauth2-mock-server": "^8.2.2",
|
|
72
72
|
"tsdown": "0.21.1",
|
|
73
|
-
"@better-auth/core": "1.7.0-beta.
|
|
74
|
-
"better-auth": "1.7.0-beta.
|
|
73
|
+
"@better-auth/core": "1.7.0-beta.3",
|
|
74
|
+
"better-auth": "1.7.0-beta.3"
|
|
75
75
|
},
|
|
76
76
|
"peerDependencies": {
|
|
77
77
|
"@better-auth/utils": "0.4.0",
|
|
78
78
|
"@better-fetch/fetch": "1.1.21",
|
|
79
79
|
"better-call": "1.3.5",
|
|
80
|
-
"@better-auth/core": "^1.7.0-beta.
|
|
81
|
-
"better-auth": "^1.7.0-beta.
|
|
80
|
+
"@better-auth/core": "^1.7.0-beta.3",
|
|
81
|
+
"better-auth": "^1.7.0-beta.3"
|
|
82
82
|
},
|
|
83
83
|
"scripts": {
|
|
84
84
|
"build": "tsdown",
|