@absolutejs/auth 0.53.8 → 0.54.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.
- package/README.md +12 -0
- package/dist/client/index.js +31 -1
- package/dist/client/index.js.map +2 -2
- package/dist/client/react.js +31 -1
- package/dist/client/react.js.map +2 -2
- package/dist/client/solid.js +31 -1
- package/dist/client/solid.js.map +2 -2
- package/dist/client/svelte.js +31 -1
- package/dist/client/svelte.js.map +2 -2
- package/dist/client/vue.js +31 -1
- package/dist/client/vue.js.map +2 -2
- package/dist/htmx/index.js +31 -1
- package/dist/htmx/index.js.map +2 -2
- package/dist/index.d.ts +0 -1
- package/dist/index.js +31 -155
- package/dist/index.js.map +4 -5
- package/dist/manifest.js +31 -1
- package/dist/manifest.js.map +2 -2
- package/dist/plugins/index.js +31 -1
- package/dist/plugins/index.js.map +2 -2
- package/dist/providers/index.js +31 -1
- package/dist/providers/index.js.map +2 -2
- package/dist/saml.d.ts +1 -0
- package/dist/saml.js +1204 -0
- package/dist/saml.js.map +11 -0
- package/dist/sso/nodeSamlAdapter.d.ts +1 -0
- package/package.json +10 -2
package/dist/index.js
CHANGED
|
@@ -1,5 +1,35 @@
|
|
|
1
1
|
// @bun
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
2
4
|
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
function __accessProp(key) {
|
|
8
|
+
return this[key];
|
|
9
|
+
}
|
|
10
|
+
var __toESMCache_node;
|
|
11
|
+
var __toESMCache_esm;
|
|
12
|
+
var __toESM = (mod, isNodeMode, target) => {
|
|
13
|
+
var canCache = mod != null && typeof mod === "object";
|
|
14
|
+
if (canCache) {
|
|
15
|
+
var cache = isNodeMode ? __toESMCache_node ??= new WeakMap : __toESMCache_esm ??= new WeakMap;
|
|
16
|
+
var cached = cache.get(mod);
|
|
17
|
+
if (cached)
|
|
18
|
+
return cached;
|
|
19
|
+
}
|
|
20
|
+
target = mod != null ? __create(__getProtoOf(mod)) : {};
|
|
21
|
+
const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
|
|
22
|
+
for (let key of __getOwnPropNames(mod))
|
|
23
|
+
if (!__hasOwnProp.call(to, key))
|
|
24
|
+
__defProp(to, key, {
|
|
25
|
+
get: __accessProp.bind(mod, key),
|
|
26
|
+
enumerable: true
|
|
27
|
+
});
|
|
28
|
+
if (canCache)
|
|
29
|
+
cache.set(mod, to);
|
|
30
|
+
return to;
|
|
31
|
+
};
|
|
32
|
+
var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
3
33
|
var __returnValue = (v) => v;
|
|
4
34
|
function __exportSetter(name, newValue) {
|
|
5
35
|
this[name] = __returnValue.bind(null, newValue);
|
|
@@ -27068,159 +27098,6 @@ var samlIdpRoutes = ({
|
|
|
27068
27098
|
ssoUrl: ssoUrlFor(request.url)
|
|
27069
27099
|
})));
|
|
27070
27100
|
};
|
|
27071
|
-
// src/sso/nodeSamlAdapter.ts
|
|
27072
|
-
var STANDARD_PROFILE_KEYS = new Set([
|
|
27073
|
-
"ID",
|
|
27074
|
-
"getAssertion",
|
|
27075
|
-
"getAssertionXml",
|
|
27076
|
-
"getSamlResponseXml",
|
|
27077
|
-
"issuer",
|
|
27078
|
-
"mainAttributes",
|
|
27079
|
-
"nameID",
|
|
27080
|
-
"nameIDFormat",
|
|
27081
|
-
"sessionIndex",
|
|
27082
|
-
"spNameQualifier"
|
|
27083
|
-
]);
|
|
27084
|
-
var DEFAULT_NAMEID_FORMAT = "urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress";
|
|
27085
|
-
var siblingEndpoints = (urls) => {
|
|
27086
|
-
const acsUrl = urls.acsUrl ?? urls.sloUrl?.replace(/\/slo(\?|$)/, "/acs$1");
|
|
27087
|
-
const sloUrl = urls.sloUrl ?? urls.acsUrl?.replace(/\/acs(\?|$)/, "/slo$1");
|
|
27088
|
-
return { acsUrl, sloUrl };
|
|
27089
|
-
};
|
|
27090
|
-
var createNodeSamlAdapter = async (options = {}) => {
|
|
27091
|
-
const { SAML } = await import("@node-saml/node-saml");
|
|
27092
|
-
const {
|
|
27093
|
-
signatureAlgorithm = "sha256",
|
|
27094
|
-
spCertificate,
|
|
27095
|
-
spPrivateKey
|
|
27096
|
-
} = options;
|
|
27097
|
-
const canSign = spPrivateKey !== undefined;
|
|
27098
|
-
const build = (connection, urls) => {
|
|
27099
|
-
const { acsUrl, sloUrl } = siblingEndpoints(urls);
|
|
27100
|
-
const baseUrl = acsUrl ?? sloUrl;
|
|
27101
|
-
if (baseUrl === undefined) {
|
|
27102
|
-
throw new Error("node-saml adapter requires an acsUrl or sloUrl to build a SAML client");
|
|
27103
|
-
}
|
|
27104
|
-
const spEntityId = new URL(baseUrl).origin;
|
|
27105
|
-
return new SAML({
|
|
27106
|
-
audience: spEntityId,
|
|
27107
|
-
callbackUrl: acsUrl ?? baseUrl,
|
|
27108
|
-
entryPoint: connection.config.idpSsoUrl,
|
|
27109
|
-
idpCert: connection.config.idpX509Cert,
|
|
27110
|
-
issuer: spEntityId,
|
|
27111
|
-
logoutUrl: connection.config.idpSloUrl,
|
|
27112
|
-
wantAssertionsSigned: true,
|
|
27113
|
-
...canSign ? {
|
|
27114
|
-
logoutCallbackUrl: sloUrl ?? baseUrl,
|
|
27115
|
-
privateKey: spPrivateKey,
|
|
27116
|
-
signatureAlgorithm
|
|
27117
|
-
} : {}
|
|
27118
|
-
});
|
|
27119
|
-
};
|
|
27120
|
-
const adapter = {
|
|
27121
|
-
createAuthorizationUrl: ({ acsUrl, connection, relayState }) => build(connection, { acsUrl }).getAuthorizeUrlAsync(relayState ?? "", undefined, {}),
|
|
27122
|
-
getServiceProviderMetadata: ({ acsUrl, connection, sloUrl }) => build(connection, {
|
|
27123
|
-
acsUrl,
|
|
27124
|
-
sloUrl
|
|
27125
|
-
}).generateServiceProviderMetadata(null, spCertificate ?? null),
|
|
27126
|
-
validateAssertion: async ({ acsUrl, connection, samlResponse }) => {
|
|
27127
|
-
const { profile: profile2 } = await build(connection, {
|
|
27128
|
-
acsUrl
|
|
27129
|
-
}).validatePostResponseAsync({ SAMLResponse: samlResponse });
|
|
27130
|
-
if (!profile2) {
|
|
27131
|
-
throw new Error("SAML response contained no assertion profile");
|
|
27132
|
-
}
|
|
27133
|
-
const attributes = {};
|
|
27134
|
-
for (const [key, value] of Object.entries(profile2)) {
|
|
27135
|
-
if (!STANDARD_PROFILE_KEYS.has(key))
|
|
27136
|
-
attributes[key] = value;
|
|
27137
|
-
}
|
|
27138
|
-
const email = profile2.email ?? (profile2.nameID.includes("@") ? profile2.nameID : undefined);
|
|
27139
|
-
const result = {
|
|
27140
|
-
attributes,
|
|
27141
|
-
email,
|
|
27142
|
-
nameId: profile2.nameID,
|
|
27143
|
-
sessionIndex: profile2.sessionIndex
|
|
27144
|
-
};
|
|
27145
|
-
return result;
|
|
27146
|
-
}
|
|
27147
|
-
};
|
|
27148
|
-
if (!canSign)
|
|
27149
|
-
return adapter;
|
|
27150
|
-
return {
|
|
27151
|
-
...adapter,
|
|
27152
|
-
createLogoutRequestUrl: ({
|
|
27153
|
-
connection,
|
|
27154
|
-
nameId,
|
|
27155
|
-
relayState,
|
|
27156
|
-
sessionIndex,
|
|
27157
|
-
sloUrl
|
|
27158
|
-
}) => {
|
|
27159
|
-
const saml = build(connection, { sloUrl });
|
|
27160
|
-
return saml.getLogoutUrlAsync({
|
|
27161
|
-
issuer: new URL(sloUrl).origin,
|
|
27162
|
-
nameID: nameId,
|
|
27163
|
-
nameIDFormat: DEFAULT_NAMEID_FORMAT,
|
|
27164
|
-
sessionIndex
|
|
27165
|
-
}, relayState ?? "", {});
|
|
27166
|
-
},
|
|
27167
|
-
createLogoutResponseUrl: ({
|
|
27168
|
-
connection,
|
|
27169
|
-
inResponseTo,
|
|
27170
|
-
nameId,
|
|
27171
|
-
relayState,
|
|
27172
|
-
sloUrl
|
|
27173
|
-
}) => {
|
|
27174
|
-
const saml = build(connection, { sloUrl });
|
|
27175
|
-
return saml.getLogoutResponseUrlAsync({
|
|
27176
|
-
ID: inResponseTo,
|
|
27177
|
-
issuer: new URL(sloUrl).origin,
|
|
27178
|
-
nameID: nameId ?? "",
|
|
27179
|
-
nameIDFormat: DEFAULT_NAMEID_FORMAT
|
|
27180
|
-
}, relayState ?? "", {}, true);
|
|
27181
|
-
},
|
|
27182
|
-
validateLogoutRequest: async ({
|
|
27183
|
-
connection,
|
|
27184
|
-
relayState,
|
|
27185
|
-
samlRequest,
|
|
27186
|
-
signature,
|
|
27187
|
-
signatureAlgorithm: sigAlg,
|
|
27188
|
-
signedQueryString,
|
|
27189
|
-
sloUrl
|
|
27190
|
-
}) => {
|
|
27191
|
-
const saml = build(connection, { sloUrl });
|
|
27192
|
-
const { profile: profile2 } = await saml.validateRedirectAsync({
|
|
27193
|
-
RelayState: relayState,
|
|
27194
|
-
SAMLRequest: samlRequest,
|
|
27195
|
-
SigAlg: sigAlg,
|
|
27196
|
-
Signature: signature
|
|
27197
|
-
}, signedQueryString ?? "");
|
|
27198
|
-
return {
|
|
27199
|
-
nameId: profile2?.nameID,
|
|
27200
|
-
relayState,
|
|
27201
|
-
requestId: profile2?.ID,
|
|
27202
|
-
sessionIndex: profile2?.sessionIndex
|
|
27203
|
-
};
|
|
27204
|
-
},
|
|
27205
|
-
validateLogoutResponse: async ({
|
|
27206
|
-
connection,
|
|
27207
|
-
relayState,
|
|
27208
|
-
samlResponse,
|
|
27209
|
-
signature,
|
|
27210
|
-
signatureAlgorithm: sigAlg,
|
|
27211
|
-
signedQueryString,
|
|
27212
|
-
sloUrl
|
|
27213
|
-
}) => {
|
|
27214
|
-
const saml = build(connection, { sloUrl });
|
|
27215
|
-
await saml.validateRedirectAsync({
|
|
27216
|
-
RelayState: relayState,
|
|
27217
|
-
SAMLResponse: samlResponse,
|
|
27218
|
-
SigAlg: sigAlg,
|
|
27219
|
-
Signature: signature
|
|
27220
|
-
}, signedQueryString ?? "");
|
|
27221
|
-
}
|
|
27222
|
-
};
|
|
27223
|
-
};
|
|
27224
27101
|
// src/sso/inMemorySamlServiceProviderStore.ts
|
|
27225
27102
|
var createInMemorySamlServiceProviderStore = () => {
|
|
27226
27103
|
const providers2 = new Map;
|
|
@@ -27993,7 +27870,6 @@ export {
|
|
|
27993
27870
|
createPostgresAccessTokenStore,
|
|
27994
27871
|
createOrganization,
|
|
27995
27872
|
createOAuthLinkedProviderCredentialResolver,
|
|
27996
|
-
createNodeSamlAdapter,
|
|
27997
27873
|
createNeonWebhookDeliveryStore,
|
|
27998
27874
|
createNeonWebAuthnCredentialStore,
|
|
27999
27875
|
createNeonWarrantStore,
|
|
@@ -28156,5 +28032,5 @@ export {
|
|
|
28156
28032
|
AuthIdentityConflictError
|
|
28157
28033
|
};
|
|
28158
28034
|
|
|
28159
|
-
//# debugId=
|
|
28035
|
+
//# debugId=37FED42605A53F9264756E2164756E21
|
|
28160
28036
|
//# sourceMappingURL=index.js.map
|