Exemple #1
0
        public Client AuthenticateClient(string username, string password)
        {
            Client client = _clientDataService.GetClientByUsername(username);

            if (client != null && PasswordHasher.Verify(password, client.Password))
            {
                return(client);
            }

            return(null);
        }
Exemple #2
0
        public string InsertClient(Client client)
        {
            if (_clientDataService.GetClientByUsername(client.Username) != null)
            {
                throw new ArgumentException("Username is already taken");
            }

            // Force client id to be empty
            client.ID       = Guid.NewGuid().ToString();
            client.Password = FinanceAPICore.Utilities.PasswordHasher.Hash(client.Password);
            return(_clientDataService.InsertClient(client) ? client.ID : null);
        }