From ed6c60127be13348aec0c77c704980004857ccb2 Mon Sep 17 00:00:00 2001 From: PascalSenn Date: Mon, 24 Jun 2024 11:56:35 +0200 Subject: [PATCH] Add login endpoint --- .../Security/EnsureAuthenticatedMiddleware.cs | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/src/Server/src/AspNet/Security/EnsureAuthenticatedMiddleware.cs b/src/Server/src/AspNet/Security/EnsureAuthenticatedMiddleware.cs index 7e6ece5..c0c16a3 100644 --- a/src/Server/src/AspNet/Security/EnsureAuthenticatedMiddleware.cs +++ b/src/Server/src/AspNet/Security/EnsureAuthenticatedMiddleware.cs @@ -22,20 +22,17 @@ public EnsureAuthenticatedMiddleware( public async Task InvokeAsync(HttpContext context) { - if (context.Request.Path.StartsWithSegments("/_health") || - context.Request.Path.StartsWithSegments("/fonts") || - context.Request.Path.StartsWithSegments("/api/session") || - _env.IsDevelopment()) - { - await _next(context); - - return; - } - if (context.Request.Path.StartsWithSegments("/api/session/auth")) { await context.ChallengeAsync(); } + else if (context.Request.Path.StartsWithSegments("/_health") || + context.Request.Path.StartsWithSegments("/fonts") || + context.Request.Path.StartsWithSegments("/api/session") || + _env.IsDevelopment()) + { + await _next(context); + } else if ( context.Request.Path.StartsWithSegments("/api") || context.Request.Path.StartsWithSegments("/graphql")