2017-01-24 22:15:21 -05:00
|
|
|
|
using System.Threading.Tasks;
|
2021-02-04 12:54:21 -06: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
|
|
|
|
|
2017-12-04 10:59:07 -05:00
|
|
|
|
namespace Bit.Core.Utilities
|
2017-01-24 22:15:21 -05:00
|
|
|
|
{
|
|
|
|
|
|
public class CurrentContextMiddleware
|
|
|
|
|
|
{
|
|
|
|
|
|
private readonly RequestDelegate _next;
|
|
|
|
|
|
|
|
|
|
|
|
public CurrentContextMiddleware(RequestDelegate next)
|
|
|
|
|
|
{
|
|
|
|
|
|
_next = next;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2021-02-04 12:54:21 -06:00
|
|
|
|
public async Task Invoke(HttpContext httpContext, ICurrentContext currentContext, GlobalSettings globalSettings)
|
2017-01-24 22:15:21 -05:00
|
|
|
|
{
|
2020-06-04 14:14:43 -04:00
|
|
|
|
await currentContext.BuildAsync(httpContext, globalSettings);
|
2017-01-24 22:15:21 -05:00
|
|
|
|
await _next.Invoke(httpContext);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|