Esempio n. 1
0
        public async Task <IActionResult> Register([FromBody] AccountModel userData)
        {
            var hashedPass = _securityServices.HashingPassword(userData.Password);

            _databaseServices.SetUser(userData.Username, hashedPass);
            var key = Guid.NewGuid().ToString().Replace("-", string.Empty).Substring(0, 20);

            _databaseServices.SetKey(userData.Username, key);
            var userToken = _securityServices.GenerateJwtToken(userData.Username, key);
            await _redisRepository.Set(key, userToken.AccesToken);

            return(Ok(userToken));
        }