OpenIddict needs to process the /.well-known/openid-configuration url to be able to return the data. (#16845)

This commit is contained in:
Sven Geusens
2024-08-05 11:11:56 +02:00
committed by GitHub
parent 5d866d7bae
commit c48490bf13

View File

@@ -10,14 +10,15 @@ public class ProcessRequestContextHandler
: IOpenIddictServerHandler<OpenIddictServerEvents.ProcessRequestContext>, IOpenIddictValidationHandler<OpenIddictValidationEvents.ProcessRequestContext>
{
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;
}
}