diff options
| author | Claus Vium <clausvium@gmail.com> | 2019-11-24 19:25:46 +0100 |
|---|---|---|
| committer | Claus Vium <clausvium@gmail.com> | 2019-11-24 19:25:46 +0100 |
| commit | 47a4f2f387825d9c249c53b3796a43e3eac52b58 (patch) | |
| tree | 7c6dd55ccb23b400f5ebb70e320f51f9625157ca /Jellyfin.Server/Extensions/ApiServiceCollectionExtensions.cs | |
| parent | 2af5922af06c865d676e817112ef76a92a23e1b6 (diff) | |
Fix more review comments
Diffstat (limited to 'Jellyfin.Server/Extensions/ApiServiceCollectionExtensions.cs')
| -rw-r--r-- | Jellyfin.Server/Extensions/ApiServiceCollectionExtensions.cs | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/Jellyfin.Server/Extensions/ApiServiceCollectionExtensions.cs b/Jellyfin.Server/Extensions/ApiServiceCollectionExtensions.cs index e5a8937e8..dd4f9cd23 100644 --- a/Jellyfin.Server/Extensions/ApiServiceCollectionExtensions.cs +++ b/Jellyfin.Server/Extensions/ApiServiceCollectionExtensions.cs @@ -2,6 +2,7 @@ using Jellyfin.Api; using Jellyfin.Api.Auth; using Jellyfin.Api.Auth.FirstTimeSetupOrElevatedPolicy; using Jellyfin.Api.Auth.RequiresElevationPolicy; +using Jellyfin.Api.Constants; using Jellyfin.Api.Controllers; using Microsoft.AspNetCore.Authentication; using Microsoft.AspNetCore.Authorization; @@ -27,17 +28,17 @@ namespace Jellyfin.Server.Extensions return serviceCollection.AddAuthorizationCore(options => { options.AddPolicy( - "RequiresElevation", + Policies.RequiresElevation, policy => { - policy.AddAuthenticationSchemes("CustomAuthentication"); + policy.AddAuthenticationSchemes(AuthenticationSchemes.CustomAuthentication); policy.AddRequirements(new RequiresElevationRequirement()); }); options.AddPolicy( - "FirstTimeSetupOrElevated", + Policies.FirstTimeSetupOrElevated, policy => { - policy.AddAuthenticationSchemes("CustomAuthentication"); + policy.AddAuthenticationSchemes(AuthenticationSchemes.CustomAuthentication); policy.AddRequirements(new FirstTimeSetupOrElevatedRequirement()); }); }); @@ -50,8 +51,8 @@ namespace Jellyfin.Server.Extensions /// <returns>The updated service collection.</returns> public static AuthenticationBuilder AddCustomAuthentication(this IServiceCollection serviceCollection) { - return serviceCollection.AddAuthentication("CustomAuthentication") - .AddScheme<AuthenticationSchemeOptions, CustomAuthenticationHandler>("CustomAuthentication", null); + return serviceCollection.AddAuthentication(AuthenticationSchemes.CustomAuthentication) + .AddScheme<AuthenticationSchemeOptions, CustomAuthenticationHandler>(AuthenticationSchemes.CustomAuthentication, null); } /// <summary> |
