public static IHttpAuthenticationFeature GetAuthentication(this HttpContext context)
 {
     var auth = context.Features.Get<IHttpAuthenticationFeature>();
     if (auth == null)
     {
         auth = new HttpAuthenticationFeature();
         context.Features.Set(auth);
     }
     return auth;
 }
 internal static IHttpAuthenticationFeature GetAuthentication(this HttpContext context)
 {
     var auth = context.GetFeature<IHttpAuthenticationFeature>();
     if (auth == null)
     {
         auth = new HttpAuthenticationFeature();
         context.SetFeature<IHttpAuthenticationFeature>(auth);
     }
     return auth;
 }
        internal static IHttpAuthenticationFeature GetAuthentication(this HttpContext context)
        {
            var auth = context.GetFeature <IHttpAuthenticationFeature>();

            if (auth == null)
            {
                auth = new HttpAuthenticationFeature();
                context.SetFeature <IHttpAuthenticationFeature>(auth);
            }
            return(auth);
        }
        IHttpAuthenticationFeature GetAuthentication()
        {
            var auth = _context.HttpContext.Features.Get <IHttpAuthenticationFeature>();

            if (auth == null)
            {
                auth = new HttpAuthenticationFeature();
                _context.HttpContext.Features.Set(auth);
            }
            return(auth);
        }
        public static IHttpAuthenticationFeature GetAuthentication(this HttpContext context)
        {
            var auth = context.Features.Get <IHttpAuthenticationFeature>();

            if (auth == null)
            {
                auth = new HttpAuthenticationFeature();
                context.Features.Set(auth);
            }
            return(auth);
        }
Example #6
0
        private void AttachAuthenticationHandler(AuthenticationHandler handler)
        {
            var auth = handler.HttpContext.Features.Get <IHttpAuthenticationFeature>();

            if (auth == null)
            {
                auth = new HttpAuthenticationFeature();
                handler.HttpContext.Features.Set(auth);
            }
            handler.PriorHandler = auth.Handler;
            auth.Handler         = handler;
        }
        public static void AttachAuthenticationHandler(this HttpContext context, IForwardingAuthenticationHandler handler, ClaimsPrincipal user = null)
        {
            var auth = context.Features.Get <IHttpAuthenticationFeature>();

            if (auth == null)
            {
                auth = new HttpAuthenticationFeature();
                context.Features.Set(auth);
            }

            auth.User    = user;
            context.User = user;

            handler.PriorHandler = auth.Handler;
            auth.Handler         = handler;
        }
        public static IApplicationBuilder UseOpenRasta(
            this IApplicationBuilder app,
            IConfigurationSource configurationSource,
            IDependencyResolverAccessor dependencyResolver = null)
        {
            return(app
                   .Use(async(context, next) =>
            {
                var auth = context.Features.Get <IHttpAuthenticationFeature>();
                if (auth == null)
                {
                    auth = new HttpAuthenticationFeature();
                    context.Features.Set(auth);
                }

                await next();
            })
                   .UseOwin(builder =>
                            builder.UseOpenRasta(
                                configurationSource,
                                dependencyResolver,
                                app.ApplicationServices.GetService <IApplicationLifetime>().ApplicationStopping)));
        }