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

            return(hasher.VerifyHashedPassword(passwordHasded, password));
        }
Exemplo n.º 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
     });
 }
Exemplo n.º 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));
        }
Exemplo n.º 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;
 }
Exemplo n.º 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;
 }
Exemplo n.º 8
0
 public AuthRepository(PassDbContext context,
                       IPasswordHash passHash,
                       IEncryptPassword encryptPassword)
 {
     _context         = context;
     _passHash        = passHash;
     _encryptPassword = encryptPassword;
 }
Exemplo n.º 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>();
 }
Exemplo n.º 10
0
        public AuthorizationService(IDbContext dbContext, IPasswordHash passwordHash, ISessionTokenGenerate sessionTokenGenerator)
        {
            _dbContext             = dbContext;
            _passwordHash          = passwordHash;
            _sessionTokenGenerator = sessionTokenGenerator;


            _timeKeyWork = new TimeSpan(24, 0, 0);
        }
Exemplo n.º 11
0
 public UserDirectoryProvider(
     IConfigurationManager configurationManager,
     IAuthenticationRepository authenticationRepository,
     IPasswordHash passwordHash, ILogService logger)
 {
     _configurationManager     = configurationManager;
     _authenticationRepository = authenticationRepository;
     _passwordHash             = passwordHash;
     _logger = logger;
 }
Exemplo n.º 12
0
 public EmployeeController(
     CurrentUserInfo currentUserInfo,
     StudioContext context,
     IPasswordHash passwordHash
     )
 {
     _currentUserInfo    = currentUserInfo;
     _context            = context;
     _passwordHash       = passwordHash;
     _accessLevelHandler = new OutputAccessLevelHandler();
 }
Exemplo n.º 13
0
        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());
            }
        }
Exemplo n.º 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;
 }
Exemplo n.º 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));
        }
Exemplo n.º 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()));
            }
        }
Exemplo n.º 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);
        }
Exemplo n.º 20
0
 public EmployeeDomain(IMasterUow uow, IPasswordHash passwordHash, IDbContextManager <MainSqlDbContext> dbContextManager)
 {
     this.Uow         = uow;
     PasswordHash     = passwordHash;
     DbContextManager = dbContextManager;
 }
Exemplo n.º 21
0
 public LinkRepository(IPasswordHash passwordHash, IConfiguration configuration)
 {
     _passwordHash  = passwordHash;
     _configuration = configuration;
 }
Exemplo n.º 22
0
 public AuthenticationController(ILoginUow loginUow, IApplicationTokenProvider tokenProvider, IPasswordHash passwordHash)
 {
     this.LoginUow            = loginUow;
     ApplicationTokenProvider = tokenProvider;
     PasswordHash             = passwordHash;
 }
Exemplo n.º 23
0
 public ForgetPasswordDomain(IMasterUow uow, IPasswordHash passwordHash)
 {
     this.Uow     = uow;
     PasswordHash = passwordHash;
 }
 public SaveUserCommand(IUserData userdata, IPasswordHash passwordHash)
 {
     _userdata     = userdata;
     _passwordHash = passwordHash;
 }
Exemplo n.º 25
0
 public RegistrationDomain(IUserUow uow, IPasswordHash passwordHash)
 {
     this.Uow     = uow;
     PasswordHash = passwordHash;
 }
Exemplo n.º 26
0
 public FacebookUserDomain(IFacebookUserUow uow, IPasswordHash passwordHash, IApplicationTokenProvider tokenProvider)
 {
     this.Uow                 = uow;
     PasswordHash             = passwordHash;
     ApplicationTokenProvider = tokenProvider;
 }
Exemplo n.º 27
0
 public LinkedInUserDomain(IUserUow uow, IPasswordHash passwordHash)
 {
     this.Uow     = uow;
     PasswordHash = passwordHash;
 }
Exemplo n.º 28
0
 public MembershipRepository(IDocumentSession repository, IPasswordHash hash)
 {
     _repository = repository;
     _hash       = hash;
 }
Exemplo n.º 29
0
 public SessionTokenGenerate(IPasswordHash passwordHash)
 {
     _passwordHash    = passwordHash;
     _userTokenLength = 50;
 }
Exemplo n.º 30
0
 public UserService(IPasswordHash passwordHash)
 {
     this.passwordHash = passwordHash;
 }
Exemplo n.º 31
0
 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;
 }