aboutsummaryrefslogtreecommitdiffstats
path: root/src/slskd/Program.cs
diff options
context:
space:
mode:
authorJP Dillingham <jp@dillingham.me>2023-01-01 23:10:20 -0600
committerGitHub <noreply@github.com>2023-01-01 23:10:20 -0600
commitbf65e2c278d3362f46a5aea3d1beedfe2488c718 (patch)
tree95c53677f2fe5c60b1fa1f2f4999a2ea6dff1171 /src/slskd/Program.cs
parent0b3b2d8849a0683558141ce2937f71eaf70902c3 (diff)
parent88dc5d8dda46b33fc438f0bc5990d11c8d891869 (diff)
downloadslskd-bf65e2c278d3362f46a5aea3d1beedfe2488c718.tar.gz
Merge pull request #819 from slskd/config
Add ApiKeyOnly auth policy and use it for Relay endpoints
Diffstat (limited to 'src/slskd/Program.cs')
-rw-r--r--src/slskd/Program.cs7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/slskd/Program.cs b/src/slskd/Program.cs
index c909d7a4..9cae6e02 100644
--- a/src/slskd/Program.cs
+++ b/src/slskd/Program.cs
@@ -626,6 +626,13 @@ namespace slskd
policy.RequireAuthenticatedUser();
});
+ options.AddPolicy(AuthPolicy.ApiKeyOnly, policy =>
+ {
+ policy.RequireRole(Role.ReadWrite.ToString(), Role.Administrator.ToString());
+ policy.AuthenticationSchemes.Add(ApiKeyAuthentication.AuthenticationScheme);
+ policy.RequireAuthenticatedUser();
+ });
+
options.AddPolicy(AuthPolicy.Any, policy =>
{
policy.AuthenticationSchemes.Add(ApiKeyAuthentication.AuthenticationScheme);