-
-
Save gdyrrahitis/e9607a341fca4b8c4d1e237ba1c08392 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class UserService : IUserService | |
{ | |
private readonly IDictionary<string, User> _users; | |
public UserService(IDictionary<string, User> users) => _users = users; | |
public Task<(bool, User)> ValidateUserCredentialsAsync(string username, string password) | |
{ | |
var isValid = _users.ContainsKey(username) && | |
string.Equals(_users[username].Password, password, StringComparison.Ordinal); | |
var result = (isValid, isValid ? _users[username] : null); | |
return Task.FromResult(result); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment