Esempio n. 1
0
        public static TtpUserManager CreateUserManager(this IdentityFactoryOptions <TtpUserManager> options, IOwinContext context)
        {
            var userStore = new UserStore <TtpUser>(context.Get <TotalTimesheetProContext>());
            var manager   = TtpUserManager.Create(userStore);

            // Register two factor authentication providers.
            // The default Microsoft MVC template uses Phone and Emails as a step of receiving a code for verifying the user
            // Disabled in this sample project
            //manager.RegisterTwoFactorProvider("Phone Code", new PhoneNumberTokenProvider<TtpUser>
            //{
            //    MessageFormat = "Your security code is {0}"
            //});
            //manager.RegisterTwoFactorProvider("Email Code", new EmailTokenProvider<TtpUser>
            //{
            //    Subject = "Security Code",
            //    BodyFormat = "Your security code is {0}"
            //});
            //manager.EmailService = new EmailService();
            //manager.SmsService = new SmsService();

            var dataProtectionProvider = options.DataProtectionProvider;

            if (dataProtectionProvider != null)
            {
                manager.UserTokenProvider =
                    new DataProtectorTokenProvider <TtpUser>(dataProtectionProvider.Create("ASP.NET Identity"));
            }

            return(manager);
        }
Esempio n. 2
0
        protected override void Dispose(bool disposing)
        {
            if (disposing && _userManager != null)
            {
                _userManager.Dispose();
                _userManager = null;
            }

            base.Dispose(disposing);
        }
Esempio n. 3
0
        protected override void Dispose(bool disposing)
        {
            if (disposing)
            {
                if (_userManager != null)
                {
                    _userManager.Dispose();
                    _userManager = null;
                }

                if (_signInManager != null)
                {
                    _signInManager.Dispose();
                    _signInManager = null;
                }
            }

            base.Dispose(disposing);
        }
Esempio n. 4
0
 public AccountController(TtpUserManager userManager, TtpSignInManager signInManager)
 {
     UserManager   = userManager;
     SignInManager = signInManager;
 }
Esempio n. 5
0
 public TtpSignInManager(TtpUserManager userManager, IAuthenticationManager authenticationManager)
     : base(userManager, authenticationManager)
 {
 }