@absolutejs/auth 0.45.7 → 0.45.8
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/index.d.ts +1 -0
- package/dist/index.js +53 -1
- package/dist/index.js.map +5 -4
- package/dist/sso/nodeSamlAdapter.d.ts +2 -0
- package/package.json +10 -4
package/dist/index.d.ts
CHANGED
|
@@ -15266,6 +15266,7 @@ export { ssoDiscoveryRoute } from './sso/discoveryRoute';
|
|
|
15266
15266
|
export { oidcSsoRoutes } from './sso/oidcRoutes';
|
|
15267
15267
|
export { samlIdpRoutes } from './sso/samlIdpRoutes';
|
|
15268
15268
|
export { samlSsoRoutes } from './sso/samlRoutes';
|
|
15269
|
+
export { createNodeSamlAdapter } from './sso/nodeSamlAdapter';
|
|
15269
15270
|
export { createInMemorySamlServiceProviderStore } from './sso/inMemorySamlServiceProviderStore';
|
|
15270
15271
|
export { createInMemorySsoConnectionStore } from './sso/inMemorySsoConnectionStore';
|
|
15271
15272
|
export { createNeonSamlServiceProviderStore, createPostgresSamlServiceProviderStore, samlServiceProvidersTable } from './sso/postgresSamlServiceProviderStore';
|
package/dist/index.js
CHANGED
|
@@ -25462,6 +25462,57 @@ var samlIdpRoutes = ({
|
|
|
25462
25462
|
ssoUrl: ssoUrlFor(request.url)
|
|
25463
25463
|
})));
|
|
25464
25464
|
};
|
|
25465
|
+
// src/sso/nodeSamlAdapter.ts
|
|
25466
|
+
var STANDARD_PROFILE_KEYS = new Set([
|
|
25467
|
+
"ID",
|
|
25468
|
+
"getAssertion",
|
|
25469
|
+
"getAssertionXml",
|
|
25470
|
+
"getSamlResponseXml",
|
|
25471
|
+
"issuer",
|
|
25472
|
+
"mainAttributes",
|
|
25473
|
+
"nameID",
|
|
25474
|
+
"nameIDFormat",
|
|
25475
|
+
"sessionIndex",
|
|
25476
|
+
"spNameQualifier"
|
|
25477
|
+
]);
|
|
25478
|
+
var createNodeSamlAdapter = async () => {
|
|
25479
|
+
const { SAML } = await import("@node-saml/node-saml");
|
|
25480
|
+
const build = (acsUrl, connection) => {
|
|
25481
|
+
const spEntityId = new URL(acsUrl).origin;
|
|
25482
|
+
return new SAML({
|
|
25483
|
+
audience: spEntityId,
|
|
25484
|
+
callbackUrl: acsUrl,
|
|
25485
|
+
entryPoint: connection.config.idpSsoUrl,
|
|
25486
|
+
idpCert: connection.config.idpX509Cert,
|
|
25487
|
+
issuer: spEntityId,
|
|
25488
|
+
logoutUrl: connection.config.idpSloUrl,
|
|
25489
|
+
wantAssertionsSigned: true
|
|
25490
|
+
});
|
|
25491
|
+
};
|
|
25492
|
+
return {
|
|
25493
|
+
createAuthorizationUrl: ({ acsUrl, connection, relayState }) => build(acsUrl, connection).getAuthorizeUrlAsync(relayState ?? "", undefined, {}),
|
|
25494
|
+
getServiceProviderMetadata: ({ acsUrl, connection }) => build(acsUrl, connection).generateServiceProviderMetadata(null),
|
|
25495
|
+
validateAssertion: async ({ acsUrl, connection, samlResponse }) => {
|
|
25496
|
+
const { profile: profile2 } = await build(acsUrl, connection).validatePostResponseAsync({ SAMLResponse: samlResponse });
|
|
25497
|
+
if (!profile2) {
|
|
25498
|
+
throw new Error("SAML response contained no assertion profile");
|
|
25499
|
+
}
|
|
25500
|
+
const attributes = {};
|
|
25501
|
+
for (const [key, value] of Object.entries(profile2)) {
|
|
25502
|
+
if (!STANDARD_PROFILE_KEYS.has(key))
|
|
25503
|
+
attributes[key] = value;
|
|
25504
|
+
}
|
|
25505
|
+
const email = profile2.email ?? (profile2.nameID.includes("@") ? profile2.nameID : undefined);
|
|
25506
|
+
const result = {
|
|
25507
|
+
attributes,
|
|
25508
|
+
email,
|
|
25509
|
+
nameId: profile2.nameID,
|
|
25510
|
+
sessionIndex: profile2.sessionIndex
|
|
25511
|
+
};
|
|
25512
|
+
return result;
|
|
25513
|
+
}
|
|
25514
|
+
};
|
|
25515
|
+
};
|
|
25465
25516
|
// src/sso/inMemorySamlServiceProviderStore.ts
|
|
25466
25517
|
var createInMemorySamlServiceProviderStore = () => {
|
|
25467
25518
|
const providers2 = new Map;
|
|
@@ -26225,6 +26276,7 @@ export {
|
|
|
26225
26276
|
createPostgresAccessTokenStore,
|
|
26226
26277
|
createOrganization,
|
|
26227
26278
|
createOAuthLinkedProviderCredentialResolver,
|
|
26279
|
+
createNodeSamlAdapter,
|
|
26228
26280
|
createNeonWebhookDeliveryStore,
|
|
26229
26281
|
createNeonWebAuthnCredentialStore,
|
|
26230
26282
|
createNeonWarrantStore,
|
|
@@ -26382,5 +26434,5 @@ export {
|
|
|
26382
26434
|
AuthIdentityConflictError
|
|
26383
26435
|
};
|
|
26384
26436
|
|
|
26385
|
-
//# debugId=
|
|
26437
|
+
//# debugId=CF175090287D988A64756E2164756E21
|
|
26386
26438
|
//# sourceMappingURL=index.js.map
|