Example #1
0
        public void ConfigureAuth(IAppBuilder app)
        {
            app.CreatePerOwinContext(MyCtx.Create);
            app.CreatePerOwinContext(() => new MyUserManager(new MyUserStore(new MyCtx())));

            var basicAuthOptions = new BasicAuthenticationOptions("KMailWebManager", validationCallback);
            app.UseBasicAuthentication(basicAuthOptions);

            app.UseExternalSignInCookie(DefaultAuthenticationTypes.ExternalCookie);

            // Enables the application to temporarily store user information when they are verifying the second factor in the two-factor authentication process.
            app.UseTwoFactorSignInCookie(DefaultAuthenticationTypes.TwoFactorCookie, TimeSpan.FromMinutes(5));

            // Enables the application to remember the second login verification factor such as phone or email.
            // Once you check this option, your second step of verification during the login process will be remembered on the device where you logged in from.
            // This is similar to the RememberMe option when you log in.
            app.UseTwoFactorRememberBrowserCookie(DefaultAuthenticationTypes.TwoFactorRememberBrowserCookie);
        }
 public static IAppBuilder UseBasicAuthentication(this IAppBuilder app, BasicAuthenticationOptions options)
 {
     return app.Use<BasicAuthenticationMiddleware>(options);
 }
 public static IAppBuilder UseBasicAuthentication(this IAppBuilder app, string realm, BasicAuthenticationMiddleware.CredentialValidationFunction  validationFunction)
 {
     var options = new BasicAuthenticationOptions(realm, validationFunction);
     return app.UseBasicAuthentication(options);
 }