public static object RegisterAuthenticationHandler(this OwinRequest request, AuthenticationHandler handler) { var chained = request.Get<AuthenticateDelegate>(Constants.SecurityAuthenticate); var hook = new Hook(handler, chained); request.Set<AuthenticateDelegate>(Constants.SecurityAuthenticate, hook.Authenticate); return hook; }
public static object RegisterAuthenticationHandler(this OwinRequest request, AuthenticationHandler handler) { var chained = request.Get <AuthenticateDelegate>(Constants.SecurityAuthenticate); var hook = new Hook(handler, chained); request.Set <AuthenticateDelegate>(Constants.SecurityAuthenticate, hook.Authenticate); return(hook); }
public override async Task Invoke(IOwinContext context) { AuthenticationHandler <TOptions> handler = CreateHandler(); await handler.Initialize(Options, context); if (!await handler.InvokeAsync()) { await Next.Invoke(context); } await handler.TeardownAsync(); }
public override async Task Invoke(OwinRequest request, OwinResponse response) { AuthenticationHandler <TOptions> handler = CreateHandler(); await handler.Initialize(Options, request, response); if (!await handler.Invoke()) { await Next.Invoke(request, response); } await handler.Teardown(); }
public override Task Invoke(IOwinContext context) { AuthenticationHandler <TOptions> handler = CreateHandler(); var initTask = handler.Initialize(Options, context); initTask.Wait(); var handlerTask = handler.InvokeAsync(); handlerTask.Wait(); if (!handlerTask.Result) { Next.Invoke(context).Wait(); } handler.TeardownAsync(); }
public Hook(AuthenticationHandler handler, AuthenticateDelegate chained) { _handler = handler; Chained = chained; }
private static void OnSendingHeaderCallback(object state) { AuthenticationHandler handler = (AuthenticationHandler)state; handler.ApplyResponseAsync().Wait(); }