Beispiel #1
0
        public async Task <PreloginResponseModel> PostPrelogin([FromBody] PreloginRequestModel model)
        {
            var kdfInformation = await _userRepository.GetKdfInformationByEmailAsync(model.Email);

            if (kdfInformation == null)
            {
                kdfInformation = new UserKdfInformation
                {
                    Kdf           = KdfType.PBKDF2_SHA256,
                    KdfIterations = 100000
                };
            }
            return(new PreloginResponseModel(kdfInformation));
        }
        public async Task PostPrelogin_WhenUserExists_ShouldReturnUserKdfInfo()
        {
            var userKdfInfo = new UserKdfInformation
            {
                Kdf           = KdfType.PBKDF2_SHA256,
                KdfIterations = 5000
            };

            _userRepository.GetKdfInformationByEmailAsync(Arg.Any <string>()).Returns(Task.FromResult(userKdfInfo));

            var response = await _sut.PostPrelogin(new PreloginRequestModel { Email = "*****@*****.**" });

            Assert.Equal(userKdfInfo.Kdf, response.Kdf);
            Assert.Equal(userKdfInfo.KdfIterations, response.KdfIterations);
        }
Beispiel #3
0
 public PreloginResponseModel(UserKdfInformation kdfInformation)
 {
     Kdf           = kdfInformation.Kdf;
     KdfIterations = kdfInformation.KdfIterations;
 }