diff --git a/song_of_the_day/Auth/ConfigurationAD.cs b/song_of_the_day/Auth/ConfigurationAD.cs new file mode 100644 index 0000000..1362fd3 --- /dev/null +++ b/song_of_the_day/Auth/ConfigurationAD.cs @@ -0,0 +1,16 @@ +public class ConfigurationAD +{ + public int Port { get; set; } = 389; + public string Zone { get; set; } = string.Empty; + public string Domain { get; set; } = string.Empty; + public string Subdomain { get; set; } = string.Empty; + + public string Username { get; set; } = string.Empty; + public string Password { get; set; } = string.Empty; + + public string LDAPserver { get; set; } = string.Empty; + public string LDAPQueryBase { get; set; } = string.Empty; + + public string Crew { get; set; } = string.Empty; + public string Managers { get; set; } = string.Empty; +} \ No newline at end of file diff --git a/song_of_the_day/Config/AppConfiguration.cs b/song_of_the_day/Config/AppConfiguration.cs index d3f7099..25b181c 100644 --- a/song_of_the_day/Config/AppConfiguration.cs +++ b/song_of_the_day/Config/AppConfiguration.cs @@ -16,8 +16,22 @@ public class AppConfiguration this.SignalGroupId = Environment.GetEnvironmentVariable("SIGNAL_GROUP_ID") ?? "group.Wmk1UTVQTnh0Sjd6a0xiOGhnTnMzZlNkc2p2Q3c0SXJiQkU2eDlNU0hyTT0="; this.WebUIBaseURL = Environment.GetEnvironmentVariable("WEB_BASE_URL") ?? "https://sotd.disi.dev/"; this.UseBotTag = bool.Parse(Environment.GetEnvironmentVariable("USE_BOT_TAG") ?? "true"); + var managersGroupName = Environment.GetEnvironmentVariable("LDAP_ADMINGROUP") ?? "admins"; + var userGroupName = Environment.GetEnvironmentVariable("LDAP_USERGROUP") ?? "everyone"; + this.LDAPConfig = new ConfigurationAD() { + Username = Environment.GetEnvironmentVariable("LDAP_BIND") ?? "cn=admin.dc=disi,dc=dev", + Password = Environment.GetEnvironmentVariable("LDAP_PASS") ?? "adminPass2022!", + Port = !string.IsNullOrEmpty(Environment.GetEnvironmentVariable("LDAP_BIND")) ? int.Parse(Environment.GetEnvironmentVariable("LDAP_BIND")) : 389, + LDAPserver = Environment.GetEnvironmentVariable("LDAP_URL") ?? "192.168.1.108", + LDAPQueryBase = Environment.GetEnvironmentVariable("LDAP_BASE") ?? "dc=disi,dc=dev", + Crew = $"cn={userGroupName},ou=groups,dc=disi,dc=dev", + Managers = $"cn={managersGroupName},ou=groups,dc=disi,dc=dev" + }; } + public string Crew { get; set; } = string.Empty; + public string Managers { get; set; } = string.Empty; + public string SignalAPIEndpointUri { get; private set; @@ -72,4 +86,8 @@ public class AppConfiguration { get; private set; } + + public ConfigurationAD LDAPConfig { + get; private set; + } } \ No newline at end of file diff --git a/song_of_the_day/song_of_the_day.csproj b/song_of_the_day/song_of_the_day.csproj index 3cffdee..c3c30ce 100644 --- a/song_of_the_day/song_of_the_day.csproj +++ b/song_of_the_day/song_of_the_day.csproj @@ -16,6 +16,7 @@ +