Exemple #1
0
        private Boolean LoginUser(string username, string password, out List <Claim> claims)
        {
            Boolean result = false;

            claims = null;

            using var cli = new nachos.io.Client(base.ConnectionString);
            var user = UserIO.Find(cli, userName: username);

            if (user != null)
            {
                if (nachos.io.utils.Encrypt.Validate(password, user.PasswordSalt, user.PasswordHash))
                {
                    claims = new List <Claim>
                    {
                        new Claim(ClaimTypes.NameIdentifier, user.Id.ToString()),
                        new Claim(ClaimTypes.Name, user.Name),
                        new Claim(ClaimTypes.Email, user.EmailAddress)
                    };

                    return(true);
                }
            }

            return(result);
        }