@absolutejs/auth 0.53.8 → 0.54.1
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 +27 -8
- 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 -2
- package/dist/index.js +31 -255
- package/dist/index.js.map +4 -6
- 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/dist/webauthn/simpleWebAuthnAdapter.d.ts +1 -0
- package/dist/webauthn.d.ts +1 -0
- package/dist/webauthn.js +1150 -0
- package/dist/webauthn.js.map +11 -0
- package/package.json +18 -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;
|
|
@@ -27265,105 +27142,6 @@ var createInMemorySsoConnectionStore = () => {
|
|
|
27265
27142
|
}
|
|
27266
27143
|
};
|
|
27267
27144
|
};
|
|
27268
|
-
// src/webauthn/simpleWebAuthnAdapter.ts
|
|
27269
|
-
var createSimpleWebAuthnAdapter = async () => {
|
|
27270
|
-
const {
|
|
27271
|
-
generateAuthenticationOptions,
|
|
27272
|
-
generateRegistrationOptions,
|
|
27273
|
-
verifyAuthenticationResponse,
|
|
27274
|
-
verifyRegistrationResponse
|
|
27275
|
-
} = await import("@simplewebauthn/server");
|
|
27276
|
-
const toBase64Url3 = (bytes) => Buffer.from(bytes).toString("base64url");
|
|
27277
|
-
const fromBase64Url3 = (value) => new Uint8Array(Buffer.from(value, "base64url"));
|
|
27278
|
-
return {
|
|
27279
|
-
createAuthenticationOptions: async ({ allowCredentials, rpId }) => {
|
|
27280
|
-
const options = await generateAuthenticationOptions({
|
|
27281
|
-
allowCredentials: allowCredentials.map(({ id }) => ({
|
|
27282
|
-
id
|
|
27283
|
-
})),
|
|
27284
|
-
rpID: rpId
|
|
27285
|
-
});
|
|
27286
|
-
return {
|
|
27287
|
-
challenge: options.challenge,
|
|
27288
|
-
options: { ...options }
|
|
27289
|
-
};
|
|
27290
|
-
},
|
|
27291
|
-
createRegistrationOptions: async ({
|
|
27292
|
-
excludeCredentials,
|
|
27293
|
-
rpId,
|
|
27294
|
-
rpName,
|
|
27295
|
-
userDisplayName,
|
|
27296
|
-
userId,
|
|
27297
|
-
userName
|
|
27298
|
-
}) => {
|
|
27299
|
-
const options = await generateRegistrationOptions({
|
|
27300
|
-
excludeCredentials: excludeCredentials.map(({ id }) => ({
|
|
27301
|
-
id
|
|
27302
|
-
})),
|
|
27303
|
-
rpID: rpId,
|
|
27304
|
-
rpName,
|
|
27305
|
-
userDisplayName,
|
|
27306
|
-
userID: Uint8Array.from(new TextEncoder().encode(userId)),
|
|
27307
|
-
userName
|
|
27308
|
-
});
|
|
27309
|
-
return {
|
|
27310
|
-
challenge: options.challenge,
|
|
27311
|
-
options: { ...options }
|
|
27312
|
-
};
|
|
27313
|
-
},
|
|
27314
|
-
verifyAuthentication: async ({
|
|
27315
|
-
credential,
|
|
27316
|
-
expectedChallenge,
|
|
27317
|
-
expectedOrigin,
|
|
27318
|
-
expectedRPID,
|
|
27319
|
-
response
|
|
27320
|
-
}) => {
|
|
27321
|
-
const result = await verifyAuthenticationResponse({
|
|
27322
|
-
credential: {
|
|
27323
|
-
counter: credential.counter,
|
|
27324
|
-
id: credential.credentialId,
|
|
27325
|
-
publicKey: fromBase64Url3(credential.publicKey)
|
|
27326
|
-
},
|
|
27327
|
-
expectedChallenge,
|
|
27328
|
-
expectedOrigin,
|
|
27329
|
-
expectedRPID,
|
|
27330
|
-
response
|
|
27331
|
-
});
|
|
27332
|
-
return {
|
|
27333
|
-
newCounter: result.authenticationInfo?.newCounter,
|
|
27334
|
-
verified: result.verified
|
|
27335
|
-
};
|
|
27336
|
-
},
|
|
27337
|
-
verifyRegistration: async ({
|
|
27338
|
-
expectedChallenge,
|
|
27339
|
-
expectedOrigin,
|
|
27340
|
-
expectedRPID,
|
|
27341
|
-
response
|
|
27342
|
-
}) => {
|
|
27343
|
-
const result = await verifyRegistrationResponse({
|
|
27344
|
-
expectedChallenge,
|
|
27345
|
-
expectedOrigin,
|
|
27346
|
-
expectedRPID,
|
|
27347
|
-
response
|
|
27348
|
-
});
|
|
27349
|
-
if (!result.verified || !result.registrationInfo) {
|
|
27350
|
-
return { verified: false };
|
|
27351
|
-
}
|
|
27352
|
-
const { credential, credentialBackedUp, credentialDeviceType } = result.registrationInfo;
|
|
27353
|
-
return {
|
|
27354
|
-
credential: {
|
|
27355
|
-
backedUp: credentialBackedUp,
|
|
27356
|
-
counter: credential.counter,
|
|
27357
|
-
credentialId: credential.id,
|
|
27358
|
-
deviceType: credentialDeviceType,
|
|
27359
|
-
publicKey: toBase64Url3(credential.publicKey),
|
|
27360
|
-
transports: credential.transports
|
|
27361
|
-
},
|
|
27362
|
-
verified: true
|
|
27363
|
-
};
|
|
27364
|
-
}
|
|
27365
|
-
};
|
|
27366
|
-
};
|
|
27367
27145
|
// src/webauthn/inMemoryWebAuthnCredentialStore.ts
|
|
27368
27146
|
var cloneCredential2 = (value) => ({
|
|
27369
27147
|
...value,
|
|
@@ -27948,7 +27726,6 @@ export {
|
|
|
27948
27726
|
createTotpKeyUri,
|
|
27949
27727
|
createTamperEvidentSink,
|
|
27950
27728
|
createStatusList,
|
|
27951
|
-
createSimpleWebAuthnAdapter,
|
|
27952
27729
|
createSiemLogStream,
|
|
27953
27730
|
createSetupSession,
|
|
27954
27731
|
createSecretCipher,
|
|
@@ -27993,7 +27770,6 @@ export {
|
|
|
27993
27770
|
createPostgresAccessTokenStore,
|
|
27994
27771
|
createOrganization,
|
|
27995
27772
|
createOAuthLinkedProviderCredentialResolver,
|
|
27996
|
-
createNodeSamlAdapter,
|
|
27997
27773
|
createNeonWebhookDeliveryStore,
|
|
27998
27774
|
createNeonWebAuthnCredentialStore,
|
|
27999
27775
|
createNeonWarrantStore,
|
|
@@ -28156,5 +27932,5 @@ export {
|
|
|
28156
27932
|
AuthIdentityConflictError
|
|
28157
27933
|
};
|
|
28158
27934
|
|
|
28159
|
-
//# debugId=
|
|
27935
|
+
//# debugId=0E38321CEDEDD5AF64756E2164756E21
|
|
28160
27936
|
//# sourceMappingURL=index.js.map
|