Пример #1
0
 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;
 }
Пример #2
0
        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);
        }
Пример #3
0
        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();
        }
Пример #4
0
        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();
        }
Пример #6
0
 public Hook(AuthenticationHandler handler, AuthenticateDelegate chained)
 {
     _handler = handler;
     Chained  = chained;
 }
Пример #7
0
 public Hook(AuthenticationHandler handler, AuthenticateDelegate chained)
 {
     _handler = handler;
     Chained = chained;
 }
Пример #8
0
        private static void OnSendingHeaderCallback(object state)
        {
            AuthenticationHandler handler = (AuthenticationHandler)state;

            handler.ApplyResponseAsync().Wait();
        }