@absolutejs/auth 0.57.5 → 0.57.6
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/cli/migrate.js.map +2 -2
- package/dist/index.js +17 -13
- package/dist/index.js.map +3 -3
- package/dist/server.js +17 -13
- package/dist/server.js.map +3 -3
- package/dist/sso/postgresSsoConnectionStore.d.ts +2 -1
- package/package.json +1 -1
package/dist/server.js
CHANGED
|
@@ -36711,13 +36711,16 @@ var toSamlConfig = (value) => {
|
|
|
36711
36711
|
idpX509Cert
|
|
36712
36712
|
};
|
|
36713
36713
|
};
|
|
36714
|
-
var toConnection = (row) => {
|
|
36714
|
+
var toConnection = async (row, cipher) => {
|
|
36715
36715
|
if (row.type === "oidc") {
|
|
36716
36716
|
const config2 = toOidcConfig(row.config);
|
|
36717
36717
|
if (config2 === undefined)
|
|
36718
36718
|
return;
|
|
36719
36719
|
const connection2 = {
|
|
36720
|
-
config:
|
|
36720
|
+
config: {
|
|
36721
|
+
...config2,
|
|
36722
|
+
clientSecret: cipher ? await cipher.decrypt(config2.clientSecret) : config2.clientSecret
|
|
36723
|
+
},
|
|
36721
36724
|
connectionId: row.connection_id,
|
|
36722
36725
|
createdAt: row.created_at_ms,
|
|
36723
36726
|
enabled: row.enabled,
|
|
@@ -36741,8 +36744,11 @@ var toConnection = (row) => {
|
|
|
36741
36744
|
};
|
|
36742
36745
|
return connection;
|
|
36743
36746
|
};
|
|
36744
|
-
var toValues3 = (connection) => ({
|
|
36745
|
-
config: connection.
|
|
36747
|
+
var toValues3 = async (connection, cipher) => ({
|
|
36748
|
+
config: connection.type === "oidc" && cipher ? {
|
|
36749
|
+
...connection.config,
|
|
36750
|
+
clientSecret: await cipher.encrypt(connection.config.clientSecret)
|
|
36751
|
+
} : connection.config,
|
|
36746
36752
|
connection_id: connection.connectionId,
|
|
36747
36753
|
created_at_ms: connection.createdAt,
|
|
36748
36754
|
enabled: connection.enabled,
|
|
@@ -36751,27 +36757,25 @@ var toValues3 = (connection) => ({
|
|
|
36751
36757
|
updated_at_ms: connection.updatedAt
|
|
36752
36758
|
});
|
|
36753
36759
|
var createNeonSsoConnectionStore = (databaseUrl) => createPostgresSsoConnectionStore(createNeonDatabase(databaseUrl));
|
|
36754
|
-
var createPostgresSsoConnectionStore = (db) => ({
|
|
36760
|
+
var createPostgresSsoConnectionStore = (db, cipher) => ({
|
|
36755
36761
|
deleteConnection: async (connectionId) => {
|
|
36756
36762
|
await db.delete(ssoConnectionsTable).where(eq(ssoConnectionsTable.connection_id, connectionId));
|
|
36757
36763
|
},
|
|
36758
36764
|
getConnection: async (connectionId) => {
|
|
36759
36765
|
const [row] = await db.select().from(ssoConnectionsTable).where(eq(ssoConnectionsTable.connection_id, connectionId)).limit(1);
|
|
36760
|
-
return row ? toConnection(row) : undefined;
|
|
36766
|
+
return row ? toConnection(row, cipher) : undefined;
|
|
36761
36767
|
},
|
|
36762
36768
|
getConnectionByOrganization: async (organizationId, type) => {
|
|
36763
36769
|
const [row] = await db.select().from(ssoConnectionsTable).where(and(eq(ssoConnectionsTable.organization_id, organizationId), eq(ssoConnectionsTable.enabled, true), type === undefined ? undefined : eq(ssoConnectionsTable.type, type))).orderBy(desc(ssoConnectionsTable.updated_at_ms)).limit(1);
|
|
36764
|
-
return row ? toConnection(row) : undefined;
|
|
36770
|
+
return row ? toConnection(row, cipher) : undefined;
|
|
36765
36771
|
},
|
|
36766
36772
|
listConnectionsByOrganization: async (organizationId) => {
|
|
36767
36773
|
const rows = await db.select().from(ssoConnectionsTable).where(eq(ssoConnectionsTable.organization_id, organizationId)).orderBy(desc(ssoConnectionsTable.updated_at_ms));
|
|
36768
|
-
|
|
36769
|
-
|
|
36770
|
-
return connection === undefined ? [] : [connection];
|
|
36771
|
-
});
|
|
36774
|
+
const connections = await Promise.all(rows.map((row) => toConnection(row, cipher)));
|
|
36775
|
+
return connections.filter((connection) => connection !== undefined);
|
|
36772
36776
|
},
|
|
36773
36777
|
saveConnection: async (connection) => {
|
|
36774
|
-
const values = toValues3(connection);
|
|
36778
|
+
const values = await toValues3(connection, cipher);
|
|
36775
36779
|
await db.insert(ssoConnectionsTable).values(values).onConflictDoUpdate({
|
|
36776
36780
|
set: values,
|
|
36777
36781
|
target: ssoConnectionsTable.connection_id
|
|
@@ -38038,5 +38042,5 @@ export {
|
|
|
38038
38042
|
auth2 as auth
|
|
38039
38043
|
};
|
|
38040
38044
|
|
|
38041
|
-
//# debugId=
|
|
38045
|
+
//# debugId=56D8E62C3DDCAF8364756E2164756E21
|
|
38042
38046
|
//# sourceMappingURL=server.js.map
|