public async Task Invoke(HttpContext context) { AuthenticationHandler <TOptions> handler = CreateHandler(); await handler.Initialize(Options, context); try { if (!await handler.InvokeAsync()) { await _next(context); } } catch (Exception) { try { handler.Faulted = true; await handler.TeardownAsync(); } catch (Exception) { // Don't mask the original exception } throw; } await handler.TeardownAsync(); }
private static void OnSendingHeaderCallback(object state) { AuthenticationHandler handler = (AuthenticationHandler)state; handler.ApplyResponse(); }