public static UserManager<ApplicationUser> Create(
            IUserStore<ApplicationUser> store_iUserStore,
            IIdentityMessageService value_iIdentityMessageService,
            IIdentityMessageService value_iIdentityMessageService1,
            IUserTokenProvider<ApplicationUser, string> value_iUserTokenProvider,
            bool value_b,
            int value_i
            )
        {
            UserManager<ApplicationUser> userManager
               = new UserManager<ApplicationUser>(store_iUserStore);
            ((UserManager<ApplicationUser, string>)userManager).EmailService =
              value_iIdentityMessageService;
            ((UserManager<ApplicationUser, string>)userManager).SmsService =
              value_iIdentityMessageService1;
            ((UserManager<ApplicationUser, string>)userManager).UserTokenProvider =
              value_iUserTokenProvider;
            ((UserManager<ApplicationUser, string>)userManager).UserLockoutEnabledByDefault
              = value_b;
            ((UserManager<ApplicationUser, string>)userManager)
              .MaxFailedAccessAttemptsBeforeLockout = value_i;
            return userManager;

            // TODO: Edit factory method of UserManager`1<ApplicationUser>
            // This method should be able to configure the object in all possible ways.
            // Add as many parameters as needed,
            // and assign their values to each field by using the API.
        }
Example #2
0
        public ContractorsController(IContractorRepository contractorRepo,
                                     ILocalizationRepository localizationRepo,
                                     IBusinessTypeRepository businessTypeRepo,
                                     IEmployeeRepository employeeTypesRepo,
                                     IVehicleRepository vehicleRepo,
                                     IContractRepository contractRepo,
                                     IEmployeeRelationshipTypeRepository employeeRelationshipTypeRepo,
                                     IWorkflowMessageService workflowMessageServ,
                                     IIdentityMessageService emailServ)
        {
            contractorRepository               = contractorRepo;
            localizationRepository             = localizationRepo;
            businessTypeRepository             = businessTypeRepo;
            employeeRepository                 = employeeTypesRepo;
            vehicleRepository                  = vehicleRepo;
            contractRepository                 = contractRepo;
            employeeRelationshipTypeRepository = employeeRelationshipTypeRepo;

            emailService = emailServ;

            workflowMessageService = workflowMessageServ;

            userManager = new UserManager <ContractorUser>(new UserStore <ContractorUser>(new ApplicationDbContext()));
            userManager.UserValidator = new UserValidator <ContractorUser>(userManager)
            {
                AllowOnlyAlphanumericUserNames = true,
                RequireUniqueEmail             = true
            };

            var provider = new DpapiDataProtectionProvider("SampleAppName");

            userManager.UserTokenProvider = new DataProtectorTokenProvider <ContractorUser>(provider.Create("SampleTokenName"));
            userManager.EmailService      = emailService;
        }
Example #3
0
        public ApplicationUserManager(IUserStore <ApplicationUser> store, IIdentityMessageService emailService,
                                      IdentityFactoryOptions <ApplicationUserManager> options)
            : base(store)
        {
            EmailService = emailService;

            UserValidator = new UserValidator <ApplicationUser>(this)
            {
                AllowOnlyAlphanumericUserNames = false,
                RequireUniqueEmail             = true
            };
            // Configure validation logic for passwords
            PasswordValidator = new PasswordValidator
            {
                RequiredLength          = 6,
                RequireNonLetterOrDigit = true,
                RequireDigit            = true,
                RequireLowercase        = true,
                RequireUppercase        = true
            };
            var dataProtectionProvider = options.DataProtectionProvider;

            if (dataProtectionProvider != null)
            {
                UserTokenProvider =
                    new DataProtectorTokenProvider <ApplicationUser>(dataProtectionProvider.Create("ASP.NET Identity"))
                {
                    TokenLifespan = TimeSpan.FromHours(24)
                }
            }
            ;
        }
    }
Example #4
0
 public AccountController(IApplicationUserManager userManager,
                          IApplicationSignInManager signInManager,
                          IAuthenticationManager authenticationManager,
                          IProfileService profileService, IUserService userService,
                          IIdentityMessageService identityMessageService,
                          IEmailService emailService,
                          IEmailIdentityService emailIdentityService,
                          IDefinitionService definitionService,
                          IBaseUserService baseuserService,
                          IUnivercityStructureService univercity,
                          IApplicationRoleManager roleManager,
                          IUnitOfWork uow)
 {
     _uow                    = uow;
     _userManager            = userManager;
     _signInManager          = signInManager;
     _authenticationManager  = authenticationManager;
     _profileService         = profileService;
     _identityMessageService = identityMessageService;
     _userService            = userService;
     _emailService           = emailService;
     _emailIdentityService   = emailIdentityService;
     _definitionService      = definitionService;
     _baseuserService        = baseuserService;
     _roleManager            = roleManager;
     _univercity             = univercity;
 }
Example #5
0
        public static UserManager <ApplicationUser> Create(
            IUserStore <ApplicationUser> store_iUserStore,
            IIdentityMessageService value_iIdentityMessageService,
            IIdentityMessageService value_iIdentityMessageService1,
            IUserTokenProvider <ApplicationUser, string> value_iUserTokenProvider,
            bool value_b,
            int value_i
            )
        {
            UserManager <ApplicationUser> userManager
                = new UserManager <ApplicationUser>(store_iUserStore);

            ((UserManager <ApplicationUser, string>)userManager).EmailService =
                value_iIdentityMessageService;
            ((UserManager <ApplicationUser, string>)userManager).SmsService =
                value_iIdentityMessageService1;
            ((UserManager <ApplicationUser, string>)userManager).UserTokenProvider =
                value_iUserTokenProvider;
            ((UserManager <ApplicationUser, string>)userManager).UserLockoutEnabledByDefault
                = value_b;
            ((UserManager <ApplicationUser, string>)userManager)
            .MaxFailedAccessAttemptsBeforeLockout = value_i;
            return(userManager);

            // TODO: Edit factory method of UserManager`1<ApplicationUser>
            // This method should be able to configure the object in all possible ways.
            // Add as many parameters as needed,
            // and assign their values to each field by using the API.
        }
Example #6
0
 public AccountAdminController(IAccountSevices Account, IIdentityMessageService Mail, ICustomerSevices Customer, ISettingSevice Setting)
 {
     _Account  = Account;
     _Mail     = Mail;
     _Customer = Customer;
     _Setting  = Setting;
 }
        public static ApplicationUserManager Create(
            ApplicationContext context,
            IIdentityMessageService emailService = null)
        {
            var manager = new ApplicationUserManager(
                new UserStore <ApplicationUser>(context));

            manager.EmailService = emailService;

            /*manager.UserValidator = new UserValidator<ApplicationUser>(manager)
             * {
             * AllowOnlyAlphanumericUserNames = false,
             * RequireUniqueEmail = true
             * };
             *
             * manager.PasswordValidator = new PasswordValidator
             * {
             * RequiredLength = 6,
             * //RequireNonLetterOrDigit = true,
             * RequireDigit = true,
             * //RequireLowercase = true,
             * //RequireUppercase = true,
             * };*/

            return(manager);
        }
        public ShroomsUserManager(IUserStore <ApplicationUser> store,
                                  IDataProtectionProvider dataProtectionProvider,
                                  IIdentityMessageService emailService,
                                  ShroomsClaimsIdentityFactory claimsIdentityFactory,
                                  ICustomCache <string, IEnumerable <string> > permissionsCache)
            : base(store)
        {
            _permissionsCache     = permissionsCache;
            UserValidator         = new ShroomsUserValidator(this);
            ClaimsIdentityFactory = claimsIdentityFactory;
            EmailService          = emailService;

            UserValidator = new ShroomsUserValidator(this)
            {
                RequireUniqueEmail             = true,
                AllowOnlyAlphanumericUserNames = false
            };

            PasswordValidator = new ShroomsPasswordValidator
            {
                RequiredLength          = 6,
                RequireNonLetterOrDigit = false,
                RequireDigit            = true,
                RequireLowercase        = true,
                RequireUppercase        = true
            };

            UserTokenProvider = new DataProtectorTokenProvider <ApplicationUser>(dataProtectionProvider.Create("ASP.NET Identity"));
        }
Example #9
0
        public ApplicationUserManager(IIdentity identity,
                                      //HttpContextBase contextBase,
                                      IPermissionService permissionService,
                                      IUserStore <User, long> userStore,
                                      IApplicationRoleManager roleManager,
                                      IUnitOfWork unitOfWork,
                                      IMappingEngine mappingEngine,
                                      IDataProtectionProvider dataProtectionProvider,
                                      IIdentityMessageService smsService,
                                      IIdentityMessageService emailService)
            : base(userStore)
        {
            _permissionService      = permissionService;
            AutoCommitEnabled       = true;
            _dataProtectionProvider = dataProtectionProvider;
            _mappingEngine          = mappingEngine;
            EmailService            = emailService;
            SmsService   = smsService;
            _unitOfWork  = unitOfWork;
            _users       = _unitOfWork.Set <User>();
            _roleManager = roleManager;
            //_contextBase = contextBase;
            _identity = identity;

            CreateApplicationUserManager();
        }
 /// <summary>
 /// The constructor takes GenericRepositories as argument, which is automatically created by ninject in NinjectWebCommon.
 /// This enables us to quickly get references to our context, by simply typing, for
 /// example, "IGenericRepository<Course> courseRepository", which we can use right away.
 /// Whenever a changes is made, use _unitOfWork.Save() to save any changes.
 /// </summary>
 /// <param name="unitOfWork"></param>
 /// <param name="studentRepository"></param>
 /// <param name="emailService"></param>
 /// <param name="mailHandler"></param>
 public StudentController(IUnitOfWork unitOfWork, IGenericRepository <Student> studentRepository, IIdentityMessageService emailService, IMailHandler mailHandler)
 {
     _studentRepository = studentRepository;
     _emailService      = emailService;
     _mailHandler       = mailHandler;
     _unitOfWork        = unitOfWork;
 }
Example #11
0
        //private readonly IFriendshipRepository _friendshipRepository;

        public PcdWebUserAppService(UserManager <User> userManager)
        {
            _userRepository = new PcdWebUserRepository();
            //_friendshipRepository = friendshipRepository;
            _emailService = new EmailService();
            _userManager  = userManager;
        }
Example #12
0
        public ApplicationUserManager(IUserStore <User, int> store, IIdentityMessageService messageService)
            : base(store)
        {
            // Configure validation logic for usernames
            UserValidator = new UserValidator <User, int>(this)
            {
                AllowOnlyAlphanumericUserNames = false,
                RequireUniqueEmail             = true
            };

            // Configure validation logic for passwords
            PasswordValidator = new PasswordValidator
            {
                RequiredLength          = 6,
                RequireNonLetterOrDigit = false,
                RequireDigit            = false,
                RequireLowercase        = false,
                RequireUppercase        = false,
            };

            // Configure user lockout defaults
            UserLockoutEnabledByDefault          = false;
            DefaultAccountLockoutTimeSpan        = TimeSpan.FromMinutes(5);
            MaxFailedAccessAttemptsBeforeLockout = 5;

            EmailService = messageService;

            UserTokenProvider =
                new DataProtectorTokenProvider <User, int>(
                    Startup.DataProtectionProvider.Create("ASP.NET Identity"));
        }
Example #13
0
 public UserService(IUserRepository repository, IIdentityMessageService mailService) : base(repository)
 {
     this.repository    = repository;
     this.UserValidator = new UserValidator <ApplicationUser>(this)
     {
         AllowOnlyAlphanumericUserNames = false,
         RequireUniqueEmail             = true
     };
     this.PasswordValidator = new PasswordValidator
     {
         RequiredLength          = 6,
         RequireNonLetterOrDigit = true,
         RequireDigit            = true,
         RequireLowercase        = true,
         RequireUppercase        = true,
     };
     this.UserLockoutEnabledByDefault          = true;
     this.DefaultAccountLockoutTimeSpan        = TimeSpan.FromMinutes(5);
     this.MaxFailedAccessAttemptsBeforeLockout = 5;
     this.RegisterTwoFactorProvider("Tokiota Store Auth", new EmailTokenProvider <ApplicationUser>
     {
         Subject    = "Security Code",
         BodyFormat = "Your security code is {0}"
     });
     this.EmailService = mailService;
 }
 /// <summary>
 /// Sync method to send the IdentityMessage
 /// </summary>
 /// <param name="service"></param>
 /// <param name="message"></param>
 public static void Send(this IIdentityMessageService service, IdentityMessage message)
 {
     if (service == null)
     {
         throw new ArgumentNullException("service");
     }
     AsyncHelper.RunSync(() => service.SendAsync(message));
 }
Example #15
0
 public AccountController(IRolesServices Role, IAccountSevices Account, IIdentityMessageService Mail, ICustomerSevices Customer, ISettingSevice Setting)
 {
     _Account = Account;
     _Mail    = Mail;
     //_Customer = Customer;
     _Setting = Setting;
     _Role    = Role;
 }
Example #16
0
        public void SetUp()
        {
            dataContextMock          = MockRepository.GenerateMock <IDataContext>();
            emailServiceMock         = MockRepository.GenerateMock <IIdentityMessageService>();
            configurationManagerMock = MockRepository.GenerateMock <IConfigurationManager>();
            playerInvitation         = new PlayerInvitation
            {
                CustomEmailMessage = "custom message",
                EmailSubject       = "email subject",
                InvitedPlayerEmail = "player email",
                InvitedPlayerId    = 1
            };
            currentUser = new ApplicationUser
            {
                CurrentGamingGroupId = 15,
                UserName             = "******"
            };
            player = new Player
            {
                Id            = playerInvitation.InvitedPlayerId,
                GamingGroupId = 135
            };
            gamingGroup = new GamingGroup
            {
                Id   = currentUser.CurrentGamingGroupId,
                Name = "jake's Gaming Group"
            };
            gamingGroupInvitation = new GamingGroupInvitation
            {
                Id = Guid.NewGuid()
            };

            dataContextMock.Expect(mock => mock.FindById <GamingGroup>(currentUser.CurrentGamingGroupId))
            .Return(gamingGroup);

            List <ApplicationUser> applicationUsers = new List <ApplicationUser>
            {
                new ApplicationUser
                {
                    Email = playerInvitation.InvitedPlayerEmail,
                    Id    = existingUserId
                }
            };

            dataContextMock.Expect(mock => mock.GetQueryable <ApplicationUser>())
            .Return(applicationUsers.AsQueryable());

            dataContextMock.Expect(mock => mock.Save <GamingGroupInvitation>(Arg <GamingGroupInvitation> .Is.Anything, Arg <ApplicationUser> .Is.Anything))
            .Return(gamingGroupInvitation);

            configurationManagerMock.Expect(mock => mock.AppSettings[PlayerInviter.APP_SETTING_URL_ROOT])
            .Return(rootUrl);

            emailServiceMock.Expect(mock => mock.SendAsync(Arg <IdentityMessage> .Is.Anything))
            .Return(Task.FromResult <object>(null));

            playerInviter = new PlayerInviter(dataContextMock, emailServiceMock, configurationManagerMock);
        }
 public ApplicationUserManagerService(IUserStore <ApplicationUser, int> store,
                                      IIdentityMessageService emailService,
                                      IDataProtectionProvider dataProtectionProvider)
     : base(store)
 {
     UserTokenProvider = new EmailTokenProvider <ApplicationUser, int>();
     EmailService      = emailService;
     Configure(dataProtectionProvider);
 }
 public UserManager(
     IUserStore <User, int> userStore,
     IPermissionStore <Permission, int> permissionStore,
     IIdentityMessageService emailService)
     : base(userStore)
 {
     _permissionStore = permissionStore;
     EmailService     = emailService;
 }
Example #19
0
        public void SetUp()
        {
            dataContextMock = MockRepository.GenerateMock<IDataContext>();
            emailServiceMock = MockRepository.GenerateMock<IIdentityMessageService>();
            configurationManagerMock = MockRepository.GenerateMock<IConfigurationManager>();
            playerInvitation = new PlayerInvitation
            {
                CustomEmailMessage = "custom message",
                EmailSubject = "email subject",
                InvitedPlayerEmail = "player email",
                InvitedPlayerId = 1
            };
            currentUser = new ApplicationUser
            {
                CurrentGamingGroupId = 15,
                UserName = "******"
            };
            player = new Player
            {
                Id = playerInvitation.InvitedPlayerId,
                GamingGroupId = 135
            };
            gamingGroup = new GamingGroup
            {
                Id = currentUser.CurrentGamingGroupId,
                Name = "jake's Gaming Group"
            };
            gamingGroupInvitation = new GamingGroupInvitation
            {
                Id = Guid.NewGuid()
            };

            dataContextMock.Expect(mock => mock.FindById<GamingGroup>(currentUser.CurrentGamingGroupId))
                           .Return(gamingGroup);

            List<ApplicationUser> applicationUsers = new List<ApplicationUser>
            {
                new ApplicationUser
                {
                    Email = playerInvitation.InvitedPlayerEmail,
                    Id = existingUserId
                }
            };
            dataContextMock.Expect(mock => mock.GetQueryable<ApplicationUser>())
                           .Return(applicationUsers.AsQueryable());

            dataContextMock.Expect(mock => mock.Save<GamingGroupInvitation>(Arg<GamingGroupInvitation>.Is.Anything, Arg<ApplicationUser>.Is.Anything))
                           .Return(gamingGroupInvitation);

            configurationManagerMock.Expect(mock => mock.AppSettings[PlayerInviter.APP_SETTING_URL_ROOT])
                                    .Return(rootUrl);

            emailServiceMock.Expect(mock => mock.SendAsync(Arg<IdentityMessage>.Is.Anything))
                            .Return(Task.FromResult<object>(null));

            playerInviter = new PlayerInviter(dataContextMock, emailServiceMock, configurationManagerMock);
        }
 public AppUserManager(
     IUserStore<AppUser> store,
     IDataProtectionProvider dataProtectionProvider,
     IIdentityMessageService emailService)
     : base(store)
 {
    
     // Configure validation logic for usernames
     UserValidator = new AppUserValidator(this);
 public RegisterController(IUserService userService,
                           ITokenValidation token, IIncomingUserMapper incomingUserMapper,
                           IIdentityMessageService emailService)
 {
     _service            = userService;
     _token              = token;
     _incomingUserMapper = incomingUserMapper;
     _emailService       = emailService;
     _tokenModel         = new TokenModel();
 }
 public RegisterController(IUserService userService,
     ITokenValidation token, IIncomingUserMapper incomingUserMapper,
     IIdentityMessageService emailService)
 {
     _service = userService;
     _token = token;
     _incomingUserMapper = incomingUserMapper;
     _emailService = emailService;
     _tokenModel = new TokenModel();
 }
        public ApplicationUserManager(
            IUserStore <ApplicationUser> store
            , IEmailService emailService
            , IIdentityMessageService identityEmailMessageService
            ) : base(store)
        {
            _emailService = emailService;

            // Configure validation logic for usernames
            UserValidator = new UserValidator <ApplicationUser>(this)
            {
                AllowOnlyAlphanumericUserNames = false,
                RequireUniqueEmail             = true
            };

            // Configure validation logic for passwords
            PasswordValidator = new PasswordValidator
            {
                RequiredLength          = 8,
                RequireNonLetterOrDigit = true,
                RequireDigit            = true,
                RequireLowercase        = true,
                RequireUppercase        = true
            };

            // Configure user lockout defaults
            UserLockoutEnabledByDefault          = true;
            DefaultAccountLockoutTimeSpan        = TimeSpan.FromMinutes(5);
            MaxFailedAccessAttemptsBeforeLockout = 5;

            // Register two factor authentication providers. This application uses Phone and Emails as a step of receiving a code for verifying the user
            // You can write your own provider and plug it in here.
            RegisterTwoFactorProvider("Phone Code", new PhoneNumberTokenProvider <ApplicationUser>
            {
                MessageFormat = "Your security code is {0}"
            });

            RegisterTwoFactorProvider("Email Code", new EmailTokenProvider <ApplicationUser>
            {
                Subject    = "Security Code",
                BodyFormat = "Your security code is {0}"
            });

            EmailService = identityEmailMessageService;
            SmsService   = new SmsService();

            UserTokenProvider = new DataProtectorTokenProvider <ApplicationUser>(_provider.Create("ASP.NET Identity"));

            //return new UserManager<ApplicationUser>(new UserStore<ApplicationUser>())
            //{
            //    UserTokenProvider =
            //        new DataProtectorTokenProvider<ApplicationUser , string>(_provider.Create("ASP.NET Identity"))
            //};
        }
 public IdentityUserManager(
     IdentityUserStore store,
     DataProtectorTokenProvider <ApplicationUser> userTokenProvider,
     IIdentityMessageService emailService,
     SmsService smsService)
     : base(store)
 {
     this.EmailService      = emailService;
     this.SmsService        = smsService;
     this.UserTokenProvider = userTokenProvider;
     ApplyDefaultSettings(this);
 }
Example #25
0
        // private readonly IApplicationSignInManager _applicationSignInManager;

        #region Public Constructors

        ///  <summary>
        ///
        ///  </summary>
        ///  <param name="mapper"></param>
        ///  <param name="applicationPermissionService"></param>
        ///  <param name="roleService"></param>
        ///  <param name="userStore"></param>
        ///  <param name="identity"></param>
        ///  <param name="dataProtectionProvider"></param>
        ///  <param name="smsService"></param>
        ///  <param name="emailService"></param>
        ///  <param name="unitOfWork"></param>
        /// <param name="listManager"></param>
        /// <param name="httpContextManager"></param>
        /// <param name="configurationManager"></param>
        public UserService(IMapper mapper, IUserStore <User, Guid> userStore, IDataProtectionProvider dataProtectionProvider, IIdentityMessageService smsService, IIdentityMessageService emailService, IRoleService roleService, IUnitOfWork unitOfWork, IHttpContextManager httpContextManager) : base(userStore)
        {
            _mapper = mapper;
            _dataProtectionProvider = dataProtectionProvider;
            _users              = unitOfWork.Set <User>();
            _roleService        = roleService;
            _unitOfWork         = unitOfWork;
            _httpContextManager = httpContextManager;
            SmsService          = smsService;
            EmailService        = emailService;
            AutoCommitEnabled   = true;
        }
 public ApplicationUserManager(IUserStore <User, long> store, IUserRepository userRepository,
                               IApplicationRoleManager roleManager, IDataProtectionProvider dataProtectionProvider,
                               IIdentityMessageService smsService, IIdentityMessageService emailService) : base(store)
 {
     _store                  = store;
     _roleManager            = roleManager;
     _dataProtectionProvider = dataProtectionProvider;
     _smsService             = smsService;
     _emailService           = emailService;
     _userRepository         = userRepository;
     CreateApplicationUserManager();
 }
Example #27
0
        public static ApplicationUserManager CreateUserManager(
            IdentityFactoryOptions <ApplicationUserManager> options,
            DbContext dbCtx,
            IIdentityMessageService emailService,
            IIdentityMessageService smsService)
        {
            var manager = new ApplicationUserManager(new UserStore <ApplicationUser>(dbCtx));

            // Configure validation logic for usernames
            manager.UserValidator = new UserValidator <ApplicationUser>(manager)
            {
                AllowOnlyAlphanumericUserNames = false,
                RequireUniqueEmail             = true
            };

            // Configure validation logic for passwords
            manager.PasswordValidator = new PasswordValidator
            {
                RequiredLength          = 4,
                RequireNonLetterOrDigit = false,
                RequireDigit            = false,
                RequireLowercase        = false,
                RequireUppercase        = false,
            };

            // Configure user lockout defaults
            manager.UserLockoutEnabledByDefault          = true;
            manager.DefaultAccountLockoutTimeSpan        = TimeSpan.FromMinutes(5);
            manager.MaxFailedAccessAttemptsBeforeLockout = 5;

            // Register two factor authentication providers. This application uses Phone and Emails as a step of receiving a code for verifying the user
            // You can write your own provider and plug it in here.
            manager.RegisterTwoFactorProvider("Phone Code", new PhoneNumberTokenProvider <ApplicationUser>
            {
                MessageFormat = "Your security code is {0}"
            });
            manager.RegisterTwoFactorProvider("Email Code", new EmailTokenProvider <ApplicationUser>
            {
                Subject    = "Security Code",
                BodyFormat = "Your security code is {0}"
            });
            manager.EmailService = emailService;
            manager.SmsService   = smsService;
            var dataProtectionProvider = options.DataProtectionProvider;

            if (dataProtectionProvider != null)
            {
                manager.UserTokenProvider =
                    new DataProtectorTokenProvider <ApplicationUser>(dataProtectionProvider.Create("ASP.NET Identity"));
            }
            return(manager);
        }
Example #28
0
        //private readonly ISendMailService _emailService;
        //private readonly DpapiDataProtectionProvider _provider = new DpapiDataProtectionProvider();

        public UserController(UserManager <IdentityUser, Guid> userManager
                              , IIdentityMessageService emailService
                              ) : base(userManager, emailService)
        {
            //_emailService = emailService;

            //if (_provider != null)
            //{
            //    var dataProtector = _provider.Create("ResetPassword");

            //    UserManager.UserTokenProvider = new DataProtectorTokenProvider<IdentityUser, Guid>(dataProtector);
            //}
        }
 public SecurityUserManager(IUserStore <SecurityUser, Guid> store, IApplicationRoleManager roleManager,
                            IDataProtectionProvider dataProtectionProvider,
                            IIdentityMessageService smsService,
                            IIdentityMessageService emailService)
     : base(store)
 {
     _store                  = store;
     _roleManager            = roleManager;
     _dataProtectionProvider = dataProtectionProvider;
     _smsService             = smsService;
     _emailService           = emailService;
     CreateApplicationUserManager();
 }
Example #30
0
        public BaseService(ApplicationDbContext db, IIdentityMessageService emailService)
        {
            this.db = db;

            Log = new LogHelper(GetType().FullName);
#if DEBUG
            this.db.Database.Log = s => { Debug.WriteLine(s); };
#else
            //this.db.Database.Log = s => { Log.Info(s); };
#endif

            EmailService = emailService;
        }
        public ApplicationUserManager(IUserStore <ApplicationUser> store, IIdentityMessageService emailService) : base(store)
        {
            // Configure validation logic for usernames
            this.UserValidator = new UserValidator <ApplicationUser>(this)
            {
                AllowOnlyAlphanumericUserNames = false,
                RequireUniqueEmail             = true
            };

            // Configure validation logic for passwords
            this.PasswordValidator = new PasswordValidator
            {
                RequiredLength          = 6,
                RequireNonLetterOrDigit = false,
                RequireDigit            = false,
                RequireLowercase        = false,
                RequireUppercase        = false,
            };

            // Configure user lockout defaults
            this.UserLockoutEnabledByDefault          = true;
            this.DefaultAccountLockoutTimeSpan        = TimeSpan.FromMinutes(5);
            this.MaxFailedAccessAttemptsBeforeLockout = 5;

            // Register two factor authentication providers. This application uses Phone and Emails as a step of receiving a code for verifying the user
            // You can write your own provider and plug it in here.
            this.RegisterTwoFactorProvider("Phone Code", new PhoneNumberTokenProvider <ApplicationUser>
            {
                MessageFormat = "Your security code is {0}"
            });
            this.RegisterTwoFactorProvider("Email Code", new EmailTokenProvider <ApplicationUser>
            {
                Subject    = "Security Code",
                BodyFormat = "Your security code is {0}"
            });
            this.EmailService = emailService;
            this.SmsService   = new SmsService();

            var dataProtectionProvider = Startup.DataProtectionProvider;

            if (dataProtectionProvider != null)
            {
                IDataProtector dataProtector = dataProtectionProvider.Create("ASP.NET Identity");

                this.UserTokenProvider = new DataProtectorTokenProvider <ApplicationUser>(dataProtector);
            }

            //alternatively use this if you are running in Azure Web Sites
            this.UserTokenProvider = new EmailTokenProvider <ApplicationUser, string>();
        }
        public ConfiguredUserManager(IUserStore <User, int> userStore,
                                     IPermissionStore <Permission, int> permissionStore,
                                     IIdentityMessageService emailService,
                                     IdentityFactoryOptions <UserManager> options)
            : base(userStore, permissionStore, emailService)
        {
            var dataProtectionProvider = options.DataProtectionProvider;

            if (dataProtectionProvider != null)
            {
                UserTokenProvider = new DataProtectorTokenProvider <User, int>(
                    dataProtectionProvider.Create("ASP.NET Identity"));
            }
        }
Example #33
0
 public UserManagerService(
     IUserStore <ApplicationUser> store,
     IdentityFactoryOptions <UserManagerService> options,
     IIdentityMessageService emailService,
     IIdentityMessageService smsService,
     ISettingsService settings)
     : base(store)
 {
     this.settings     = settings;
     this.options      = options;
     this.EmailService = emailService;
     this.SmsService   = smsService;
     this.Setup();
 }
 public AbitInfoIdentityProvider(IDataProtectionProvider provider, IIdentityMessageService service)
 {
     _dataProtectionProvider = provider;
     _service = service;
 }
Example #35
0
 public SubscribeService(DbContext unitOfWork, IIdentityMessageService messageService)
     :base(unitOfWork)
 {
     _subscriberRepository = unitOfWork.Set<Subscriber>();
     _messageService = messageService;
 }
Example #36
0
 public AdminController(IAdminService adminService, IIdentityMessageService emailService)
 {
 }
Example #37
0
 public PlayerInviter(IDataContext dataContext, IIdentityMessageService emailService, IConfigurationManager configurationManager)
 {
     this.dataContext = dataContext;
     this.emailService = emailService;
     this.configurationManager = configurationManager;
 }
 public PhoneNumberTokenProvider(IAuthenticationService authenticationService, IIdentityMessageService identityMessageService)
     : base(authenticationService)
 {
     this.identityMessageService = identityMessageService;
 }