diff options
| author | JP Dillingham <jp@dillingham.me> | 2023-01-01 23:10:20 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-01-01 23:10:20 -0600 |
| commit | bf65e2c278d3362f46a5aea3d1beedfe2488c718 (patch) | |
| tree | 95c53677f2fe5c60b1fa1f2f4999a2ea6dff1171 /src/slskd/Program.cs | |
| parent | 0b3b2d8849a0683558141ce2937f71eaf70902c3 (diff) | |
| parent | 88dc5d8dda46b33fc438f0bc5990d11c8d891869 (diff) | |
| download | slskd-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.cs | 7 |
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); |
