Ejemplo n.º 1
0
        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();
        }
Ejemplo n.º 2
0
        private static void OnSendingHeaderCallback(object state)
        {
            AuthenticationHandler handler = (AuthenticationHandler)state;

            handler.ApplyResponse();
        }