[backend/federation] Bypass authorized fetch for relay actor (ISH-529)
This commit is contained in:
parent
2fbff537a6
commit
c21147c86f
1 changed files with 7 additions and 4 deletions
|
@ -28,6 +28,9 @@ public class AuthorizedFetchMiddleware(
|
||||||
{
|
{
|
||||||
public static ServiceLifetime Lifetime => ServiceLifetime.Scoped;
|
public static ServiceLifetime Lifetime => ServiceLifetime.Scoped;
|
||||||
|
|
||||||
|
private static string? _instanceActorUri;
|
||||||
|
private static string? _relayActorUri;
|
||||||
|
|
||||||
public async Task InvokeAsync(HttpContext ctx, RequestDelegate next)
|
public async Task InvokeAsync(HttpContext ctx, RequestDelegate next)
|
||||||
{
|
{
|
||||||
// Ensure we're rendering HTML markup (AsyncLocal)
|
// Ensure we're rendering HTML markup (AsyncLocal)
|
||||||
|
@ -45,9 +48,9 @@ public class AuthorizedFetchMiddleware(
|
||||||
var request = ctx.Request;
|
var request = ctx.Request;
|
||||||
var ct = appLifetime.ApplicationStopping;
|
var ct = appLifetime.ApplicationStopping;
|
||||||
|
|
||||||
//TODO: cache this somewhere
|
_instanceActorUri ??= $"/users/{(await systemUserSvc.GetInstanceActorAsync()).Id}";
|
||||||
var instanceActorUri = $"/users/{(await systemUserSvc.GetInstanceActorAsync()).Id}";
|
_relayActorUri ??= $"/users/{(await systemUserSvc.GetRelayActorAsync()).Id}";
|
||||||
if (request.Path.Value == instanceActorUri)
|
if (request.Path.Value == _instanceActorUri || request.Path.Value == _relayActorUri)
|
||||||
{
|
{
|
||||||
await next(ctx);
|
await next(ctx);
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Add table
Reference in a new issue