Beispiel #1
0
 public LoginController(IWoWDbContext dbContext, IReader reader, IWriter writer, IPasswordHash hasher)
 {
     this.dbContext = dbContext;
     this.reader    = reader;
     this.writer    = writer;
     this.hasher    = hasher;
 }
Beispiel #2
0
        public virtual bool VerifiPassword(TUser user, string password)
        {
            string        passwordHasded = GetPasswordHash(user);
            IPasswordHash hasher         = GetHasher();

            return(hasher.VerifyHashedPassword(passwordHasded, password));
        }
Beispiel #3
0
 public Employee ToModel(Occupation occupation, IPasswordHash passwordHash)
 {
     return(new Employee
     {
         AccessLevel = AccessLevel,
         Gender = Gender,
         Occupation = occupation,
         OccupationId = occupation.Id,
         ParticipatingPhotoShoots = null,
         Rg = Rg,
         User = new User
         {
             Active = true,
             BirthDate = BirthDate,
             Cpf = Misc.StripCpf(Cpf),
             Email = Email,
             Name = Name,
             Password = Password == null
                 ? null
                 : passwordHash.Of(Password),
             Phone = Phone,
             SocialName = SocialName
         },
         UserId = Cpf
     });
 }
Beispiel #4
0
        public UserRepository(ILogger logger, IPasswordHash passwordHash, IConfiguration configuration)
        {
            _logger = logger;

            _passwordHash  = passwordHash ?? throw new ArgumentNullException(nameof(passwordHash));
            _configuration = configuration ?? throw new ArgumentNullException(nameof(configuration));
        }
Beispiel #5
0
 public UserRepository(Func <QueryFactory> queryFactory, IPasswordHash passwordHash, ICloudStorage cloudStorage, IOptions <CloudStorageOptions> options, ITransactionRepository transactions) : base(queryFactory)
 {
     _queryFactory = queryFactory;
     _passwordHash = passwordHash;
     _cloudStorage = cloudStorage;
     _transactions = transactions;
     _options      = options.Value;
 }
Beispiel #6
0
 public AppRepository(PassDbContext context,
                      IPasswordHash passHash,
                      IEncryptPassword encryptPass)
 {
     _context     = context;
     _passHash    = passHash;
     _encryptPass = encryptPass;
 }
 public AccountManagerController(IConfiguration configuration, IUsersRepository usersRepository, IPasswordHash passwordHash, IUsersModelBuilder usersModelBuilder, ILoginUtil loginUtil)
 {
     _configuration         = configuration;
     this.usersRepository   = usersRepository;
     this.passwordHash      = passwordHash;
     this.usersModelBuilder = usersModelBuilder;
     this.loginUtil         = loginUtil;
 }
Beispiel #8
0
 public AuthRepository(PassDbContext context,
                       IPasswordHash passHash,
                       IEncryptPassword encryptPassword)
 {
     _context         = context;
     _passHash        = passHash;
     _encryptPassword = encryptPassword;
 }
Beispiel #9
0
 public RegisterController(ICreateEntity playerCreator, IReader reader, IWriter writer, IPasswordHash hasher)
 {
     this.playerCreator         = playerCreator;
     this.reader                = reader;
     this.writer                = writer;
     this.hasher                = hasher;
     this.entityCharacteristics = new List <string>();
 }
        public AuthorizationService(IDbContext dbContext, IPasswordHash passwordHash, ISessionTokenGenerate sessionTokenGenerator)
        {
            _dbContext             = dbContext;
            _passwordHash          = passwordHash;
            _sessionTokenGenerator = sessionTokenGenerator;


            _timeKeyWork = new TimeSpan(24, 0, 0);
        }
Beispiel #11
0
 public UserDirectoryProvider(
     IConfigurationManager configurationManager,
     IAuthenticationRepository authenticationRepository,
     IPasswordHash passwordHash, ILogService logger)
 {
     _configurationManager     = configurationManager;
     _authenticationRepository = authenticationRepository;
     _passwordHash             = passwordHash;
     _logger = logger;
 }
 public EmployeeController(
     CurrentUserInfo currentUserInfo,
     StudioContext context,
     IPasswordHash passwordHash
     )
 {
     _currentUserInfo    = currentUserInfo;
     _context            = context;
     _passwordHash       = passwordHash;
     _accessLevelHandler = new OutputAccessLevelHandler();
 }
        static void WriteTestHash(IPasswordHash ph, string password)
        {
            Console.WriteLine("Class:    {0}", ph.GetType());

            string hash = ph.Hash(password);
            Console.WriteLine("Password: {0}", password);
            Console.WriteLine("Hash:     {0}", hash);

            Console.WriteLine("Match:    {0}", ph.Verify(password, hash));
            Console.WriteLine();
        }
        /// <summary>
        /// Create an IPasswordHash implementation, using the best available key-derivation function implementation.
        /// </summary>
        public static IPasswordHash CreatePasswordHash()
        {
            if (bestPasswordHash != null)
                return bestPasswordHash;

            lock (passwordHashCreationLock)
            {
                if (bestPasswordHash != null)
                    return bestPasswordHash;

                return bestPasswordHash = new DefaultPasswordHash(CreateKeyDerivationFunction());
            }
        }
Beispiel #15
0
 public UserController(
     CurrentUserInfo currentUserInfo,
     StudioContext context,
     IPictureStorage <User, string> pictureStorage,
     IPasswordHash passwordHash
     )
 {
     _currentUserInfo = currentUserInfo;
     _context         = context;
     _pictureStorage  = pictureStorage;
     _outputHandler   = new OutputUserHandler();
     _passwordHash    = passwordHash;
 }
Beispiel #16
0
 public bool ValidatePassword(string password, IPasswordHash oldPasswordHashData)
 {
     try
     {
         Utility.Encryption.PasswordHash hashProvider = Utility.Encryption.PasswordHash.New();
         hashProvider.SetSalt(oldPasswordHashData.Salt);
         var result = hashProvider.ValidatePassword(password, oldPasswordHashData.Hash);
         return(result);
     }
     catch (Exception ex)
     {
         throw new SpiderPasswordHashProviderException(ex);
     }
 }
        public void GlobalSetupGetUser()
        {
            _userDataMock = new Mock <IUserData>();

            _userBase = UsersData(_userId);

            _userData = _userDataMock.Object;

            _passwordHash    = new PasswordHash();
            _usersController = new UsersController(
                new GetUserByIdQuery(_userData),
                new SaveUserCommand(_userData, _passwordHash),
                new UpdateUserCommand(_userData, _passwordHash),
                new DeleteUserCommand(_userData),
                new AddClaimUserCommnad(_userData),
                new RemoveClaimUserCommnad(_userData));
        }
Beispiel #18
0
        /// <summary>
        /// Create an IPasswordHash implementation, using the best available key-derivation function implementation.
        /// </summary>
        public static IPasswordHash CreatePasswordHash()
        {
            if (bestPasswordHash != null)
            {
                return(bestPasswordHash);
            }

            lock (passwordHashCreationLock)
            {
                if (bestPasswordHash != null)
                {
                    return(bestPasswordHash);
                }

                return(bestPasswordHash = new DefaultPasswordHash(CreateKeyDerivationFunction()));
            }
        }
Beispiel #19
0
        public int CreateUser(IServiceContext serviceContext, User request, IPasswordHash passwordHashData)
        {
            var dbContext = DbContext(serviceContext);

            var entity = new UserEntity()
            {
                CreateDate   = DateTime.UtcNow,
                Login        = request.Login,
                PasswordSalt = passwordHashData.Salt,
                PasswordHash = passwordHashData.Hash,
                IsActive     = false,
            };

            dbContext.Users.Add(entity);
            dbContext.SaveChanges();
            return(entity.UserId);
        }
Beispiel #20
0
 public EmployeeDomain(IMasterUow uow, IPasswordHash passwordHash, IDbContextManager <MainSqlDbContext> dbContextManager)
 {
     this.Uow         = uow;
     PasswordHash     = passwordHash;
     DbContextManager = dbContextManager;
 }
Beispiel #21
0
 public LinkRepository(IPasswordHash passwordHash, IConfiguration configuration)
 {
     _passwordHash  = passwordHash;
     _configuration = configuration;
 }
Beispiel #22
0
 public AuthenticationController(ILoginUow loginUow, IApplicationTokenProvider tokenProvider, IPasswordHash passwordHash)
 {
     this.LoginUow            = loginUow;
     ApplicationTokenProvider = tokenProvider;
     PasswordHash             = passwordHash;
 }
Beispiel #23
0
 public ForgetPasswordDomain(IMasterUow uow, IPasswordHash passwordHash)
 {
     this.Uow     = uow;
     PasswordHash = passwordHash;
 }
 public SaveUserCommand(IUserData userdata, IPasswordHash passwordHash)
 {
     _userdata     = userdata;
     _passwordHash = passwordHash;
 }
Beispiel #25
0
 public RegistrationDomain(IUserUow uow, IPasswordHash passwordHash)
 {
     this.Uow     = uow;
     PasswordHash = passwordHash;
 }
 public FacebookUserDomain(IFacebookUserUow uow, IPasswordHash passwordHash, IApplicationTokenProvider tokenProvider)
 {
     this.Uow                 = uow;
     PasswordHash             = passwordHash;
     ApplicationTokenProvider = tokenProvider;
 }
 public LinkedInUserDomain(IUserUow uow, IPasswordHash passwordHash)
 {
     this.Uow     = uow;
     PasswordHash = passwordHash;
 }
 public MembershipRepository(IDocumentSession repository, IPasswordHash hash)
 {
     _repository = repository;
     _hash       = hash;
 }
Beispiel #29
0
 public SessionTokenGenerate(IPasswordHash passwordHash)
 {
     _passwordHash    = passwordHash;
     _userTokenLength = 50;
 }
Beispiel #30
0
 public UserService(IPasswordHash passwordHash)
 {
     this.passwordHash = passwordHash;
 }
 public UserDomain(IUserUow uow, IPasswordHash passwordHash)
 {
     this.Uow          = uow;
     this.PasswordHash = passwordHash;
 }
 public AuthenticationService(IFormAuthenticationService formsAuthentication, IPasswordHash passwordHash, HttpContextBase context)
 {
     this.formsAuthentication = formsAuthentication;
     this.passwordHash        = passwordHash;
     this.context             = context;
 }