feat(ldap): Adding support for LDAP authentication (#554)

This commit is contained in:
WolverinDEV
2024-08-24 16:15:33 +02:00
committed by GitHub
parent 4924f76394
commit 4186a768b3
17 changed files with 573 additions and 128 deletions

View File

@@ -0,0 +1,11 @@
/*
Warnings:
- A unique constraint covering the columns `[ldapDN]` on the table `User` will be added. If there are existing duplicate values, this will fail.
*/
-- AlterTable
ALTER TABLE "User" ADD COLUMN "ldapDN" TEXT;
-- CreateIndex
CREATE UNIQUE INDEX "User_ldapDN_key" ON "User"("ldapDN");

View File

@@ -16,6 +16,7 @@ model User {
email String @unique
password String?
isAdmin Boolean @default(false)
ldapDN String? @unique
shares Share[]
refreshTokens RefreshToken[]

View File

@@ -144,6 +144,42 @@ const configVariables: ConfigVariables = {
obscured: true,
},
},
ldap: {
enabled: {
type: "boolean",
defaultValue: "false",
secret: false,
},
url: {
type: "string",
defaultValue: "",
},
bindDn: {
type: "string",
defaultValue: "",
},
bindPassword: {
type: "string",
defaultValue: "",
obscured: true,
},
searchBase: {
type: "string",
defaultValue: "",
},
searchQuery: {
type: "string",
defaultValue: ""
},
adminGroups: {
type: "string",
defaultValue: ""
}
},
oauth: {
"allowRegistration": {
type: "boolean",
@@ -308,7 +344,7 @@ async function migrateConfigVariables() {
for (const existingConfigVariable of existingConfigVariables) {
const configVariable =
configVariables[existingConfigVariable.category]?.[
existingConfigVariable.name
existingConfigVariable.name
];
// Delete the config variable if it doesn't exist in the seed