forked from ahaenggli/AzureAD-LDAP-wrapper
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.js
64 lines (46 loc) · 3.47 KB
/
config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
'use strict';
require('dotenv').config();
var config = {};
// AZURE
config.AZURE_APP_ID = process.env.AZURE_APP_ID;
config.AZURE_APP_SECRET = process.env.AZURE_APP_SECRET;
config.AZURE_TENANTID = process.env.AZURE_TENANTID;
// LDAP
config.LDAP_ANONYMOUSBIND = (process.env.LDAP_ANONYMOUSBIND || "domain").toLowerCase().replace(/ /g, '');
config.LDAP_SENSITIVE_ATTRIBUTES = (process.env.LDAP_SENSITIVE_ATTRIBUTES || "").replace(/ /g, '');
config.LDAP_SECURE_ATTRIBUTES = (process.env.LDAP_SECURE_ATTRIBUTES || "").replace(/ /g, '');
config.LDAP_DOMAIN = (process.env.LDAP_DOMAIN || "example.net").toLowerCase().replace(/ /g, '');
config.LDAP_BASEDN = (process.env.LDAP_BASEDN || "dc=example,dc=net").toLowerCase().replace(/ /g, '');
config.LDAP_SAMBADOMAINNAME = (process.env.LDAP_SAMBADOMAINNAME || config.LDAP_BASEDN.split(",")[0].replace("dc=", ""));
config.LDAP_SAMBASIDBASE = (process.env.LDAP_SAMBASIDBASE|| "S-1-5-21-2475342291-1480345137-508597502").toUpperCase().replace(/ /g, '');
config.LDAP_SAMBA_USEAZURESID = true;
if (process.env.LDAP_SAMBA_USEAZURESID) config.LDAP_SAMBA_USEAZURESID = (process.env.LDAP_SAMBA_USEAZURESID == "true" || process.env.LDAP_SAMBA_USEAZURESID == "1");
config.LDAP_GROUPSDN = (process.env.LDAP_GROUPSDN || "cn=groups," + config.LDAP_BASEDN).toLowerCase().replace(/ /g, '');
config.LDAP_USERSDN = (process.env.LDAP_USERSDN || "cn=users," + config.LDAP_BASEDN).toLowerCase().replace(/ /g, '');
config.LDAP_USERSGROUPSBASEDN = (process.env.LDAP_USERSGROUPSBASEDN || "cn=users," + config.LDAP_GROUPSDN).toLowerCase().replace(/ /g, '');
config.LDAP_USERRDN = (process.env.LDAP_USERRDN || "uid").toLowerCase().replace(/ /g, '');
config.LDAP_DATAFILE = process.env.LDAP_DATAFILE || "./.cache/azure.json";
config.LDAP_SYNC_TIME = process.env.LDAP_SYNC_TIME || 30; /* minutes */
// GRAPH
config.GRAPH_FILTER_USERS = ""; if (process.env.GRAPH_FILTER_USERS) config.GRAPH_FILTER_USERS = "&$filter="+encodeURIComponent(process.env.GRAPH_FILTER_USERS);
config.GRAPH_FILTER_GROUPS = "";if (process.env.GRAPH_FILTER_GROUPS) config.GRAPH_FILTER_GROUPS = "&$filter="+encodeURIComponent(process.env.GRAPH_FILTER_GROUPS);
config.GRAPH_IGNORE_MFA_ERRORS = (process.env.GRAPH_IGNORE_MFA_ERRORS == "true" || process.env.GRAPH_IGNORE_MFA_ERRORS == "1");
// set to true to remove the domain e.g. "[email protected]" will just be "alice" for login
config.LDAP_REMOVEDOMAIN = true;
if (process.env.LDAP_REMOVEDOMAIN) config.LDAP_REMOVEDOMAIN = (process.env.LDAP_REMOVEDOMAIN == "true" || process.env.LDAP_REMOVEDOMAIN == "1");
config.LDAP_PORT = parseInt(process.env.LDAP_PORT) || 389;
config.LDAP_BINDUSER = process.env.LDAP_BINDUSER;
config.LDAP_DEBUG = false;
if (process.env.LDAP_DEBUG) config.LDAP_DEBUG = (process.env.LDAP_DEBUG == "true" || process.env.LDAP_DEBUG == "1");
config.LDAP_ALLOWCACHEDLOGINONFAILURE = true;
if (process.env.LDAP_ALLOWCACHEDLOGINONFAILURE) config.LDAP_ALLOWCACHEDLOGINONFAILURE = (process.env.LDAP_ALLOWCACHEDLOGINONFAILURE == "true" || process.env.LDAP_ALLOWCACHEDLOGINONFAILURE == "1");
config.LDAP_SAMBANTPWD_MAXCACHETIME = process.env.LDAP_SAMBANTPWD_MAXCACHETIME || -1;
config.LDAP_DAYSTOKEEPDELETEDUSERS = (process.env.LDAP_DAYSTOKEEPDELETEDUSERS == "0")? 0 : parseInt(process.env.LDAP_DAYSTOKEEPDELETEDUSERS) || 7;
// LDAPS
config.LDAPS_CERTIFICATE = process.env.LDAPS_CERTIFICATE;
config.LDAPS_KEY = process.env.LDAPS_KEY;
// DSM 7.0
config.DSM7 = false;
if (process.env.DSM7) config.DSM7 = (process.env.DSM7 == "true" || process.env.DSM7 == "1");
// export
module.exports = config;