feat(auth): initial auth added, refs NOISSUE
This commit is contained in:
		
							
								
								
									
										16
									
								
								song_of_the_day/Auth/ConfigurationAD.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								song_of_the_day/Auth/ConfigurationAD.cs
									
									
									
									
									
										Normal file
									
								
							@@ -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;
 | 
			
		||||
}
 | 
			
		||||
@@ -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;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -16,6 +16,7 @@
 | 
			
		||||
    <PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="9.0.4" />
 | 
			
		||||
    <PackageReference Include="NSwag.ApiDescription.Client" Version="13.0.5" />
 | 
			
		||||
    <PackageReference Include="Scalar.AspNetCore" Version="2.1.*" />
 | 
			
		||||
    <PackageReference Include="System.DirectoryServices.Protocols" Version="*" />
 | 
			
		||||
  </ItemGroup>
 | 
			
		||||
  <ItemGroup>
 | 
			
		||||
    <OpenApiReference Include="swagger.json" SourceUrl="https://bbernhard.github.io/signal-cli-rest-api/src/docs/swagger.json" />
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user