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/Pages | |
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/Pages')
-rw-r--r-- | VPNAuth.Server/Pages/Auth.cshtml.cs | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/VPNAuth.Server/Pages/Auth.cshtml.cs b/VPNAuth.Server/Pages/Auth.cshtml.cs index 1f75492..ea648cb 100644 --- a/VPNAuth.Server/Pages/Auth.cshtml.cs +++ b/VPNAuth.Server/Pages/Auth.cshtml.cs @@ -7,6 +7,7 @@ namespace VPNAuth.Server.Pages; public class Auth : PageModel { public Config Config; + public ConfigApp? ConfApp; public ConfigUser? User; public bool ValidRequest; public EntityEntry<AuthRequest>? RequestEntry; @@ -23,12 +24,14 @@ public class Auth : PageModel public void OnGet() { Config = Config.Read(); + ConfApp = Config.FindApp(Request.Query["client_id"]); User = HttpContext.GetUser(); ValidRequest = RequiredQueryParams.All(key => Request.Query.ContainsKey(key)) - && Config.FindApp(Request.Query["client_id"]!) != null + && ConfApp != null && Request.Query["code_challenge_method"] == "S256" - && User != null; + && User != null + && (ConfApp.AllowedUsers == null || ConfApp.AllowedUsers!.Contains(User.Username!)); RequestEntry = null; |