From 953edf4b378aa0a041385e3af85ed867ab68bf37 Mon Sep 17 00:00:00 2001 From: Joscha <34318751+josxha@users.noreply.github.com> Date: Tue, 19 Mar 2024 21:22:34 +0100 Subject: [PATCH] clean up startup --- KratosSelfService/Startup.cs | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/KratosSelfService/Startup.cs b/KratosSelfService/Startup.cs index bf0f3743..4a0df7d5 100644 --- a/KratosSelfService/Startup.cs +++ b/KratosSelfService/Startup.cs @@ -20,19 +20,17 @@ public void ConfigureServices(IServiceCollection services) options.DefaultChallengeScheme = "DefaultScheme"; // 401 Unauthorized options.DefaultForbidScheme = "DefaultScheme"; // 403 Forbid }); - services.AddAuthorization(options => - { - options.AddPolicy("LoggedIn", policyBuilder => { policyBuilder.RequireClaim(ClaimTypes.NameIdentifier); }); - // The fallback authorization policy requires all users to be authenticated, except for controllers or action - // methods with an authorization attribute. For example, controllers or action methods with [AllowAnonymous] or - // [Authorize(PolicyName="MyPolicy")] use the applied authorization attribute rather than the fallback - // authorization policy. - // The fallback authorization policy is applied to all requests that don't explicitly specify an authorization - // policy. - options.FallbackPolicy = new AuthorizationPolicyBuilder() + + // The fallback authorization policy requires all users to be authenticated, except for controllers or action + // methods with an authorization attribute. For example, controllers or action methods with [AllowAnonymous] or + // [Authorize(PolicyName="MyPolicy")] use the applied authorization attribute rather than the fallback + // authorization policy. + // The fallback authorization policy is applied to all requests that don't explicitly specify an authorization + // policy. + services.AddAuthorizationBuilder() + .SetFallbackPolicy(new AuthorizationPolicyBuilder() .RequireAuthenticatedUser() - .Build(); - }); + .Build()); // localisation services.AddLocalization(options => options.ResourcesPath = "Resources");