diff options
author | Tim <contact@bytim.eu> | 2025-04-22 16:02:36 +0200 |
---|---|---|
committer | Tim <contact@bytim.eu> | 2025-04-22 16:02:36 +0200 |
commit | a3fd9ff79a98259590b7004fd1bbe79be7ff8e83 (patch) | |
tree | f3a76a00bbcb2d8cb31b93da395a6aa710678417 /VPNAuth.Server/Config.cs | |
parent | f7fad5370f47781b12b065173b3f5ef46756bde0 (diff) | |
download | VPNAuth-a3fd9ff79a98259590b7004fd1bbe79be7ff8e83.tar.xz VPNAuth-a3fd9ff79a98259590b7004fd1bbe79be7ff8e83.zip |
Add config option to only let specific users log into app
Diffstat (limited to 'VPNAuth.Server/Config.cs')
-rw-r--r-- | VPNAuth.Server/Config.cs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/VPNAuth.Server/Config.cs b/VPNAuth.Server/Config.cs index 32e72fa..cb57f11 100644 --- a/VPNAuth.Server/Config.cs +++ b/VPNAuth.Server/Config.cs @@ -13,6 +13,7 @@ public class ConfigApp public string? ClientId { get; set; } public string? RedirectUri { get; set; } public string? Secret { get; set; } + public List<string>? AllowedUsers { get; set; } } public class Config @@ -20,7 +21,7 @@ public class Config public List<ConfigUser>? Users { get; set; } public List<ConfigApp>? Apps { get; set; } - public ConfigApp? FindApp(string clientId) + public ConfigApp? FindApp(string? clientId) => Apps?.Find(app => app.ClientId == clientId); private static string _filePath = "./config.json"; @@ -29,10 +30,10 @@ public class Config { if (File.Exists(_filePath)) return; - File.Create(_filePath); File.WriteAllText(_filePath, JsonSerializer.Serialize(new Config { - Users = [] + Users = [], + Apps = [] })); } |