2022-06-29 19:46:41 -04:00
|
|
|
|
using Bit.Core.Context;
|
2021-02-22 15:35:16 -06:00
|
|
|
|
using Bit.Core.Settings;
|
2018-08-02 12:14:33 -04:00
|
|
|
|
using Microsoft.AspNetCore.Http;
|
2017-01-24 22:15:21 -05:00
|
|
|
|
|
2022-08-29 14:53:16 -04:00
|
|
|
|
namespace Bit.Core.Utilities;
|
|
|
|
|
|
|
|
|
|
|
|
public class CurrentContextMiddleware
|
2017-01-24 22:15:21 -05:00
|
|
|
|
{
|
2022-08-29 14:53:16 -04:00
|
|
|
|
private readonly RequestDelegate _next;
|
2017-01-24 22:15:21 -05:00
|
|
|
|
|
2022-08-29 14:53:16 -04:00
|
|
|
|
public CurrentContextMiddleware(RequestDelegate next)
|
|
|
|
|
|
{
|
|
|
|
|
|
_next = next;
|
|
|
|
|
|
}
|
2017-01-24 22:15:21 -05:00
|
|
|
|
|
2022-08-29 14:53:16 -04:00
|
|
|
|
public async Task Invoke(HttpContext httpContext, ICurrentContext currentContext, GlobalSettings globalSettings)
|
|
|
|
|
|
{
|
|
|
|
|
|
await currentContext.BuildAsync(httpContext, globalSettings);
|
|
|
|
|
|
await _next.Invoke(httpContext);
|
2017-01-24 22:15:21 -05:00
|
|
|
|
}
|
|
|
|
|
|
}
|