diff --git a/src/Umbraco.Cms.Api.Common/DependencyInjection/ProcessRequestContextHandler.cs b/src/Umbraco.Cms.Api.Common/DependencyInjection/ProcessRequestContextHandler.cs index c680ab6b34..21776b740f 100644 --- a/src/Umbraco.Cms.Api.Common/DependencyInjection/ProcessRequestContextHandler.cs +++ b/src/Umbraco.Cms.Api.Common/DependencyInjection/ProcessRequestContextHandler.cs @@ -10,14 +10,15 @@ public class ProcessRequestContextHandler : IOpenIddictServerHandler, IOpenIddictValidationHandler { private readonly IHttpContextAccessor _httpContextAccessor; - private readonly string _backOfficePathSegment; + private readonly string[] _pathsToHandle; public ProcessRequestContextHandler(IHttpContextAccessor httpContextAccessor) { _httpContextAccessor = httpContextAccessor; - _backOfficePathSegment = Constants.System.DefaultUmbracoPath.TrimStart(Constants.CharArrays.Tilde) + var backOfficePathSegment = Constants.System.DefaultUmbracoPath.TrimStart(Constants.CharArrays.Tilde) .EnsureStartsWith('/') .EnsureEndsWith('/'); + _pathsToHandle = [backOfficePathSegment, "/.well-known/openid-configuration"]; } public ValueTask HandleAsync(OpenIddictServerEvents.ProcessRequestContext context) @@ -48,6 +49,14 @@ public class ProcessRequestContextHandler return false; } - return requestPath.StartsWith(_backOfficePathSegment) is false; + foreach (var path in _pathsToHandle) + { + if (requestPath.StartsWith(path)) + { + return false; + } + } + + return true; } }