diff options
| author | JP Dillingham <jp@dillingham.me> | 2025-12-13 16:46:28 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-12-13 16:46:28 -0600 |
| commit | 54584b8edd08f704427355d59323163086102207 (patch) | |
| tree | fc3e4fb320af056b25bd8d2d9c3fbd48cdd454f8 /src/slskd/Program.cs | |
| parent | 999b903244233747e1a190fb88af372ea2c5f2ab (diff) | |
| parent | 1e0eb94a16fd6b8a3204bc14e11c0c5d47617d0c (diff) | |
| download | slskd-54584b8edd08f704427355d59323163086102207.tar.gz | |
Merge pull request #1587 from slskd/api-key
Add the ability to configure an API key via environment variables and command line
Diffstat (limited to 'src/slskd/Program.cs')
| -rw-r--r-- | src/slskd/Program.cs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/slskd/Program.cs b/src/slskd/Program.cs index 288fa0e3..cb1961a2 100644 --- a/src/slskd/Program.cs +++ b/src/slskd/Program.cs @@ -768,7 +768,7 @@ namespace slskd var jwtSigningKey = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(OptionsAtStartup.Web.Authentication.Jwt.Key)); services.AddSingleton(jwtSigningKey); - services.AddSingleton<ISecurityService, SecurityService>(); + services.AddSingleton<SecurityService>(); if (!OptionsAtStartup.Web.Authentication.Disabled) { @@ -835,7 +835,7 @@ namespace slskd try { // check to see if the provided value is a valid API key - var service = services.BuildServiceProvider().GetRequiredService<ISecurityService>(); + var service = services.BuildServiceProvider().GetRequiredService<SecurityService>(); var (name, role) = service.AuthenticateWithApiKey(token, callerIpAddress: context.HttpContext.Connection.RemoteIpAddress); // the API key is valid. create a new, short lived jwt for the key name and role |
