Ejemplo n.º 1
0
        public AuthModule(IUserValidator userValidator)
        {
            Get["/login"] = args =>
            {
                return View["home/home.html"];
            };

            Get["/logout"] = args =>
            {
                return this.LogoutAndRedirect("~/");
            };

            Post["/login"] = args =>
            {

                var userGuid = userValidator.UserIsValid((string)this.Request.Form.UserName, (string)this.Request.Form.Password);

                if (!userGuid.HasValue)
                {
                    return this.Context.GetRedirect("~/login?error=true&username=" + (string)this.Request.Form.Username);
                }

                DateTime? expiry = null;
                if (this.Request.Form.RememberMe.HasValue)
                {
                    expiry = DateTime.Now.AddDays(7);
                }

                return this.LoginAndRedirect(userGuid.Value, expiry);
            };
        }
Ejemplo n.º 2
0
 public Game()
 {
     characterQuery = new GetCharacterInfoQueryHandler();
     choiceHandler = new UserChoiceHandler();
     createCharacterHandler = new CreateCharacterHandler();
     userValidator = new DatabaseUserValidator();
 }
Ejemplo n.º 3
0
        public bool Persist(IUserValidator validator)
        {
            bool bValid = validator.Validate(this);

            if(bValid) bValid = this.Gateway.Persist(this);

            return bValid;
        }
Ejemplo n.º 4
0
        public AdminController(UserManager <AppUser> usrMgr, IUserValidator <AppUser> userValid, IPasswordValidator <AppUser> passValid, IPasswordHasher <AppUser> passwordНash, MainDBContext mdb, ApplicationDbContext adb)
        {
            userManager       = usrMgr;
            userValidator     = userValid;
            passwordValidator = passValid;
            passwordHasher    = passwordНash;

            mainDBContext        = mdb;
            applicationDbContext = adb;
        }
Ejemplo n.º 5
0
 public UserApiController(IUserSaver userSaver,
                          IUserDataFinder userDataFinder,
                          IDataRemover dataRemover,
                          IUserValidator userValidator)
 {
     _userSaver      = userSaver;
     _userDataFinder = userDataFinder;
     _dataRemover    = dataRemover;
     _userValidator  = userValidator;
 }
Ejemplo n.º 6
0
 public AdminController(IUserValidator <User> usrVal,
                        UserManager <User> usrMgr,
                        IPasswordHasher <User> passMgr,
                        IPasswordValidator <User> passVal)
 {
     userManager       = usrMgr;
     userValidator     = usrVal;
     passwordHasher    = passMgr;
     passwordValidator = passVal;
 }
Ejemplo n.º 7
0
 public AccountController(UserManager <Account> userMgr, SignInManager <Account> signinMgr, IPasswordHasher <Account> passwordHash, IPasswordValidator <Account> passwordValid, IUserValidator <Account>
                          userValid, InsuranceContext context)
 {
     userManager       = userMgr;
     signInManager     = signinMgr;
     passwordHasher    = passwordHash;
     passwordValidator = passwordValid;
     userValidator     = userValid;
     _context          = context;
 }
Ejemplo n.º 8
0
 public AccountController(AppIdentityDbContext context, SignInManager <AppUser> signInManager, IPasswordHasher <AppUser> passwordHasher, IUserValidator <AppUser> userValidator, IPasswordValidator <AppUser> passwordValidator, UserManager <AppUser> userManager, ILogger <AccountController> logger)
 {
     this.context           = context;
     this.passwordValidator = passwordValidator;
     this.passwordHasher    = passwordHasher;
     this.userValidator     = userValidator;
     this.userManager       = userManager;
     this.logger            = logger;
     this.signInManager     = signInManager;
 }
 public TeamViewService(ITeamMapper teamMapper, IUserRepository userRepository, IUserValidator userValidator, 
     ITeamValidator teamValidator, IUserMapper userMapper, ITeamRepository teamRepository)
 {
     _teamMapper = teamMapper;
     _teamRepository = teamRepository;
     _userMapper = userMapper;
     _teamValidator = teamValidator;
     _userValidator = userValidator;
     _userRepository = userRepository;
 }
Ejemplo n.º 10
0
 public AdminController(UserManager <AppUser> userManager,
                        IUserValidator <AppUser> userValidator,
                        IPasswordValidator <AppUser> passwordValidator,
                        IPasswordHasher <AppUser> passwordHasher)
 {
     this.userManager       = userManager;
     this.userValidator     = userValidator;
     this.passwordValidator = passwordValidator;
     this.passwordHasher    = passwordHasher;
 }
Ejemplo n.º 11
0
 public TeacherController(ITeacherService teacherService, ISubjectService subjectService, IPasswordHasher <AppUser> passwordHash, IPasswordValidator <AppUser> passValid, UserManager <AppUser> userManager, IUserValidator <AppUser> userValid, RoleManager <IdentityRole> roleManager)
 {
     _userManager       = userManager;
     _subjectService    = subjectService;
     _teacherService    = teacherService;
     _userValidator     = userValid;
     _roleManager       = roleManager;
     _passwordValidator = passValid;
     _passwordHasher    = passwordHash;
 }
Ejemplo n.º 12
0
 public AccountController(UserManager <AppUser> userMgr, SignInManager <AppUser> signinMgr, IPasswordHasher <AppUser> passwordHash, IPasswordValidator <AppUser> passwordVal, IUserValidator <AppUser>
                          userValid, ProBetContext context)
 {
     userManager       = userMgr;
     signInManager     = signinMgr;
     passwordHasher    = passwordHash;
     passwordValidator = passwordVal;
     userValidator     = userValid;
     _context          = context;
 }
Ejemplo n.º 13
0
 public AuthController(UserManager <VesizleUser> userManager, IMapper mapper, IPasswordValidator <VesizleUser> passwordValidator, IPasswordHasher <VesizleUser> passwordHasher, SignInManager <VesizleUser> signInManager, IUserValidator <VesizleUser> userValidator, RoleManager <VesizleRole> roleManager)
 {
     _userManager       = userManager;
     _mapper            = mapper;
     _passwordValidator = passwordValidator;
     _passwordHasher    = passwordHasher;
     _signInManager     = signInManager;
     _userValidator     = userValidator;
     _roleManager       = roleManager;
 }
Ejemplo n.º 14
0
 public AdminController(UserManager <AppUser> usrMgr,
                        IUserValidator <AppUser> userValid,
                        IPasswordValidator <AppUser> passValid,
                        IPasswordHasher <AppUser> passwordHash)
 {
     userManager       = usrMgr;
     userValidator     = userValid;
     passwordValidator = passValid;
     passwordHasher    = passwordHash;
 }
Ejemplo n.º 15
0
 public EditModel(UserManager <ApplicationUser> usrMgr,
                  IUserValidator <ApplicationUser> userValid,
                  IPasswordValidator <ApplicationUser> passValid,
                  IPasswordHasher <ApplicationUser> passwordHash)
 {
     userManager       = usrMgr;
     userValidator     = userValid;
     passwordValidator = passValid;
     passwordHasher    = passwordHash;
 }
Ejemplo n.º 16
0
 public UserManager(IUserStore <IdentityUser> store,
                    IOptions <IdentityOptions> optionsAccessor,
                    IPasswordHasher <IdentityUser> passwordHasher, IUserValidator <IdentityUser>
                    userValidators, IPasswordValidator <IdentityUser> passwordValidators,
                    ILookupNormalizer keyNormalizer, IdentityErrorDescriber errors,
                    IServiceProvider services, ILogger <UserManager <IdentityUser> > logger) :
     base(store, optionsAccessor, passwordHasher,
          userValidators, passwordValidators, keyNormalizer, errors, services, logger)
 {
 }
Ejemplo n.º 17
0
 public AdminController(UserManager <AppUser> usrMgr, IUserValidator <AppUser> userValid,
                        IPasswordValidator <AppUser> passValid, IPasswordHasher <AppUser> passwordHash,
                        RoleManager <IdentityRole> roleMgr)
 {
     userManager       = usrMgr;
     userValidator     = userValid;
     passwordValidator = passValid;
     passwordHasher    = passwordHash;
     roleManager       = roleMgr;
 }
Ejemplo n.º 18
0
 public AdminController(
     UserManager <AppUser> usrmgr,
     IUserValidator <AppUser> usrVal,
     IPasswordValidator <AppUser> pswdVal,
     IPasswordHasher <AppUser> pswdHash)
 {
     userManager       = usrmgr;
     userValidator     = usrVal;
     passwordValidator = pswdVal;
     passwordHasher    = pswdHash;
 }
Ejemplo n.º 19
0
 public UserService(
     IMapper mapper,
     IUserValidator userValidator,
     IUserRepository userRepository,
     IUserPasswordService userPasswordService)
 {
     _mapper              = mapper;
     _userValidator       = userValidator;
     _userRepository      = userRepository;
     _userPasswordService = userPasswordService;
 }
Ejemplo n.º 20
0
 public AdminController(UserManager <AppUser> usrMgr, IPasswordHasher <AppUser> passwordHash,
                        IPasswordValidator <AppUser> passwordVal, IUserValidator <AppUser> userValid, RoleManager <IdentityRole> roleManager,
                        KnowledgeBaseContext context)
 {
     userManager       = usrMgr;
     passwordHasher    = passwordHash;
     passwordValidator = passwordVal;
     userValidator     = userValid;
     _roleManager      = roleManager;
     _context          = context;
 }
Ejemplo n.º 21
0
 public ApplicationUserController(
     UserManager <ApplicationUser> userMgr,
     IUserValidator <ApplicationUser> userValid,
     IPasswordValidator <ApplicationUser> passValid,
     IPasswordHasher <ApplicationUser> passHasher)
 {
     userManager       = userMgr;
     userValidator     = userValid;
     passwordValidator = passValid;
     passwordHasher    = passHasher;
 }
Ejemplo n.º 22
0
        /// <summary>
        /// Initializes a new instance of the <see cref="UserStorage"/> class.
        /// </summary>
        /// <param name="userIdGenerator">The user identifier generator.</param>
        /// <param name="userValidator">The user validator.</param>
        /// <exception cref="System.ArgumentNullException">userIdGenerator</exception>
        public UserStorage(IUserIdGenerator userIdGenerator, IUserValidator userValidator = null)
        {
            if (userIdGenerator == null)
            {
                throw new ArgumentNullException(nameof(userIdGenerator));
            }

            this.userIdGenerator = userIdGenerator;
            this.userValidator   = userValidator;
            this.storage         = new List <User>();
        }
Ejemplo n.º 23
0
 public AdminController(RoleManager <Role> roleMgr, UserManager <User> userManager, IAccountManager accountManager, IMapper mapper,
                        IPasswordHasher <User> passwordHasher, IPasswordValidator <User> passwordValidator,
                        IUserValidator <User> _userValidator, IClaimRepo claim, RollerDataContext context)
 {
     roleManager     = roleMgr;
     _userManager    = userManager;
     _accountManager = accountManager;
     _mapper         = mapper;
     _claim          = claim;
     _context        = context;
 }
Ejemplo n.º 24
0
 /// <summary>
 /// Creates instance of UserController.
 /// </summary>
 /// <param name="userManager">Identity user manager.</param>
 /// <param name="userValidator">Identity user validator.</param>
 /// <param name="passwordValidator">Identity password validator.</param>
 /// <param name="passwordHasher">Identity password hasher.</param>
 public UserController(
     UserManager <User> userManager,
     IUserValidator <User> userValidator,
     IPasswordValidator <User> passwordValidator,
     IPasswordHasher <User> passwordHasher)
 {
     _userManager        = userManager;
     _userValidator      = userValidator;
     _passwordValidator  = passwordValidator;
     this.passwordHasher = passwordHasher;
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="BasicAuthenticationConfiguration"/> class.
        /// </summary>
        /// <param name="userValidator">A valid instance of <see cref="IUserValidator"/> class</param>
        /// <param name="realm">Basic authentication realm</param>
        public BasicAuthenticationConfiguration(IUserValidator userValidator, string realm)
        {
            if (userValidator == null)
                throw new ArgumentNullException("userValidator");

            if (string.IsNullOrEmpty(realm))
                throw new ArgumentException("realm");

            this.UserValidator = userValidator;
            this.Realm = realm;
        }
Ejemplo n.º 26
0
 public AdminController(ICarRepository repo, UserManager <AppUser> usrMng, IPasswordValidator <AppUser> passValid, IPasswordHasher <AppUser> passHasher, IUserValidator <AppUser> userValid, IWebHostEnvironment hostEnvironment, ApplicationDbContext _context, IConfiguration configuration)
 {
     repository            = repo;
     userManager           = usrMng;
     passwordValidator     = passValid;
     userValidator         = userValid;
     passwordHasher        = passHasher;
     this._configuration   = configuration;
     this._hostEnvironment = hostEnvironment;
     context = _context;
 }
 public UserViewService(IUserRepository userRepository, IWorkshopRepository workshopRepository, ITeamRepository teamRepository,
     IUserValidator userValidator, IUserMapper userMapper, ICryptographerService cryptoService, IUserService userService)
 {
     _userRepository = userRepository;
     _userService = userService;
     _cryptoService = cryptoService;
     _userMapper = userMapper;
     _userValidator = userValidator;
     _workshopRepository = workshopRepository;
     _teamRepository = teamRepository;
 }
Ejemplo n.º 28
0
 public AdminController(UserManager <AppUser> usrManager, IUserValidator <AppUser> userValid,
                        IPasswordValidator <AppUser> passValid, IPasswordHasher <AppUser> passHash, ITeamRepository teamRepo, IUserRepository userRepository)
 {
     _userManager = usrManager;
     // inicjacja pól potrzebnych do edycji usera
     _userValidator     = userValid;
     _passwordValidator = passValid;
     _passwordHasher    = passHash;
     _teamRepository    = teamRepo;
     _userRepository    = userRepository;
 }
Ejemplo n.º 29
0
 public AccountController(AppUserManager userManager, SignInManager <AppUser> signInManager,
                          IUserValidator <AppUser> userValidator,
                          IPasswordValidator <AppUser> passwordValidator,
                          IPasswordHasher <AppUser> passwordHasher)
 {
     this.userManager       = userManager;
     this.signInManager     = signInManager;
     this.userValidator     = userValidator;
     this.passwordValidator = passwordValidator;
     this.passwordHasher    = passwordHasher;
 }
        public GenericUserService(IUserSettingsService settingsService, IUserRepository <TRepositoryUser, TKey> userRepository, IPasswordHasher passwordHasher, IPasswordValidator passwordValidator, IUserValidator <TServiceUser, TKey> userValidator, IClaimsIndentityService <TServiceUser, TKey> claimsIndentityService)
        {
            _settingsService = settingsService;
            _userRepository  = userRepository;

            _passwordHasher         = passwordHasher;
            _passwordValidator      = passwordValidator;
            _userValidator          = userValidator;
            _claimsIndentityService = claimsIndentityService;
            _userValidator.AllowOnlyAlphanumericUserNames = _settingsService.UsernameOnlyAlphaNumerics;
        }
 public UserController(
     IAuthService auth,
     IUserStorage storage,
     IUserValidator validator,
     ILogger logger)
 {
     _auth      = auth;
     _storage   = storage;
     _validator = validator;
     _logger    = logger;
 }
Ejemplo n.º 32
0
 public LoginController(UserManager <AppUser> userMgr,
                        SignInManager <AppUser> signinMgr, IUserValidator <AppUser> userValid,
                        IPasswordValidator <AppUser> passValid,
                        IPasswordHasher <AppUser> passwordHash)
 {
     _userManager      = userMgr;
     _signInManager    = signinMgr;
     userValidator     = userValid;
     passwordValidator = passValid;
     passwordHasher    = passwordHash;
 }
        public void UserModuleTest_SetUp()
        {
            _userStore        = Substitute.For <IUserStore>();
            _userValidator    = Substitute.For <IUserValidator>();
            _passwordProvider = Substitute.For <IPasswordProvider>();

            Mapper.Initialize((cfg) =>
            {
                cfg.CreateMap <UserViewModel, UserModel>();
            });
        }
Ejemplo n.º 34
0
 public UserController(UserManager <IdentityUser> userManager,
                       IPasswordValidator <IdentityUser> passwordValidator,
                       IPasswordHasher <IdentityUser> passwordHasher,
                       IUserValidator <IdentityUser> userValidator,
                       IUnitOfWork unitOfWork,
                       RoleManager <IdentityRole> roleManager)
 {
     _userValidator = userValidator;
     _userManager   = userManager;
     _unitOfWork    = unitOfWork;
     _roleManager   = roleManager;
 }
Ejemplo n.º 35
0
        public AccountManager(
            IAccountContext accountContext, ICryptoProvider cryptoProvider, 
            ISystemContext systemContext, IDependencyResolver dependencyResolver)
        {
            this.accountContext = accountContext;
            this.cryptoProvider = cryptoProvider;
            this.systemContext = systemContext;
            this.dependencyResolver = dependencyResolver;

            //This resolved instance is delayed until here because we want to make sure the user validator also uses the same DB Access instances
            this.userValidator = dependencyResolver.Resolve<IUserValidator>(DependencyOverride.CreateNew<IUsersRepository>(accountContext.Users));
        }
Ejemplo n.º 36
0
 public EmployeeAdminController(UserManager <EmployeeUser> usrMgr,
                                IUserValidator <EmployeeUser> userValid,
                                IPasswordValidator <EmployeeUser> passValid,
                                IPasswordHasher <EmployeeUser> passwordHash,
                                INorthwindRepository repo)
 {
     userManager       = usrMgr;
     userValidator     = userValid;
     passwordValidator = passValid;
     passwordHasher    = passwordHash;
     repository        = repo;
 }
Ejemplo n.º 37
0
            public CommandValidator(IUserValidator validator)
            {
                RuleFor(c => c.UserName).NotNull().NotEmpty();
                RuleFor(c => c.UserName)
                .MustAsync(validator.NameNotTakenAsync).WithMessage(ErrorMessages.USERNAME_ALREADY_TAKEN);

                RuleFor(c => c.FirstName).NotNull().NotEmpty();
                RuleFor(c => c.Password).NotNull().NotEmpty();
                RuleFor(c => c.ConfirmedPassword)
                .Must((command, confirmedPassword) => validator.PasswordMatchesConfirmation(command.Password, confirmedPassword))
                .WithMessage(ErrorMessages.PASSWORDS_DONT_MATCH);
            }
 private void SetUpDependencies()
 {
     _userRepository = _administrationMockRepository.GetUserRepository();
     _workshopRepository = _administrationMockRepository.GetWorkshopRepository();
     _teamRepository = _administrationMockRepository.GetTeamRepository();
     _cryptographerService = _administrationMockRepository.GetCryptographerService();
     _userMapper = _administrationMockRepository.GetUserMapper();
     _userValidator = _administrationMockRepository.GetUserValidator(true);
     _workshopMapper = _administrationMockRepository.GetWokshopMapper();
     _teamMapper = _administrationMockRepository.GetTeamMapper();
     _teamValidator = _administrationMockRepository.GetTeamValidator(true);
     _workshopValidator = _administrationMockRepository.GetWorkshopValidator(true);
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="BasicAuthenticationConfiguration"/> class.
        /// </summary>
        /// <param name="userValidator">A valid instance of <see cref="IUserValidator"/> class</param>
        /// <param name="realm">Basic authentication realm</param>
        /// <param name="userPromptBehaviour">Control when the browser should be instructed to prompt for credentials</param>
        public BasicAuthenticationConfiguration(IUserValidator userValidator, string realm, UserPromptBehaviour userPromptBehaviour = Basic.UserPromptBehaviour.NonAjax)
        {
            if (userValidator == null)
            {
                throw new ArgumentNullException("userValidator");
            }

            if (string.IsNullOrEmpty(realm))
            {
                throw new ArgumentException("realm");
            }

            this.UserValidator = userValidator;
            this.Realm = realm;
            this.UserPromptBehaviour = userPromptBehaviour;
        }
Ejemplo n.º 40
0
			public NancyBootstrapper(ApiImplementation scheduler, IUserValidator validator)
			{
				_scheduler = scheduler;
				_validator = validator;
			}
Ejemplo n.º 41
0
 public MetaWeblog(IContentService contentService, IUserValidator userValidator)
 {
     ContentService = contentService;
     UserValidator = userValidator;
 }
Ejemplo n.º 42
0
 public UserService(IUserRepository _userRepository, IUserValidator _userValidator)
 {
     _repository = _userRepository;
     _validator = _userValidator;
 }
 public AccountController(UserManager<CustomUser> userManager, SignInManager<CustomUser> signInManager, IUserValidator<CustomUser> userValidator)
 {
     this.userManager = userManager;
     this.signInManager = signInManager;
     this.userValidator = userValidator;
 }
 public AccountController()
 {
     userValidator = new DatabaseUserValidator();
 }
Ejemplo n.º 45
0
 public UserService(IUserValidator validator, IUserRepository repository)
 {
     this.validator = validator;
     this.repository = repository;
 }