From e35825dc8aadf6ea780fdb1f4f98965a018ea9f0 Mon Sep 17 00:00:00 2001 From: maliming Date: Fri, 21 Aug 2026 14:33:37 +0800 Subject: [PATCH] Simplify OpenIddict endpoint path normalization --- .../Volo/Abp/OpenIddict/AbpOpenIddictAspNetCoreModule.cs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/modules/openiddict/src/Volo.Abp.OpenIddict.AspNetCore/Volo/Abp/OpenIddict/AbpOpenIddictAspNetCoreModule.cs b/modules/openiddict/src/Volo.Abp.OpenIddict.AspNetCore/Volo/Abp/OpenIddict/AbpOpenIddictAspNetCoreModule.cs index 09f1001104..edaa453b2e 100644 --- a/modules/openiddict/src/Volo.Abp.OpenIddict.AspNetCore/Volo/Abp/OpenIddict/AbpOpenIddictAspNetCoreModule.cs +++ b/modules/openiddict/src/Volo.Abp.OpenIddict.AspNetCore/Volo/Abp/OpenIddict/AbpOpenIddictAspNetCoreModule.cs @@ -66,8 +66,6 @@ public class AbpOpenIddictAspNetCoreModule : AbpModule }); } - private static readonly Uri RootUri = new Uri("http://localhost/"); - private static IEnumerable GetServerEndpointPaths(OpenIddictServerOptions serverOptions) { var endpoints = serverOptions.TokenEndpointUris @@ -80,9 +78,9 @@ public class AbpOpenIddictAspNetCoreModule : AbpModule foreach (var uri in endpoints) { - // Resolve relative endpoint URIs (e.g. "connect/token" or "./connect/token") to an absolute path. - var path = (uri.IsAbsoluteUri ? uri : new Uri(RootUri, uri)).AbsolutePath; - if (!string.IsNullOrWhiteSpace(path) && path != "/") + // Normalize the (usually relative) endpoint URI to an absolute path, e.g. "connect/token" -> "/connect/token". + var path = uri.IsAbsoluteUri ? uri.AbsolutePath : "/" + uri.OriginalString.RemovePreFix("./").TrimStart('/'); + if (path.Length > 1) { yield return path; }