Esempio n. 1
0
        public static IServiceCollection AddQuickAppBasicAuth <TUser>(this IServiceCollection serviceCollection,
                                                                      Action <BasicAuthConfiguration <TUser> > configAction)
        {
            var config = new BasicAuthConfiguration <TUser>();

            configAction?.Invoke(config);
            serviceCollection.AddSingleton(provider => config);
            serviceCollection.AddSingleton <IBasicCookieAuthentication, BasicCookieAuthentication <TUser> >();
            serviceCollection.AddScoped <IHttpContextAccessor, HttpContextAccessor>();
            serviceCollection.AddAuthentication(options => options.SignInScheme = CookieAuthenticationDefaults.AuthenticationScheme);

            return(serviceCollection);
        }
Esempio n. 2
0
 public BasicCookieAuthentication(BasicAuthConfiguration <TUser> configuration, IServiceProvider serviceProvider)
 {
     _configuration   = configuration;
     _serviceProvider = serviceProvider;
 }