March 2018
Beginner to intermediate
410 pages
10h 40m
English
The authentication method used in our application is simple. It checks the user database to see if a user with the given name is available. Then it checks the password hash method used and calculates the corresponding hash of the provided password. If the hashes match, credentials are authenticated. If not, or if the hash method is not recognized, authentication fails:
private IUser Login(string UserName, string Password) { if (this.users.TryGetUser(UserName, out IUser User)) { switch (User.PasswordHashType) { case "": if (Password == User.PasswordHash) return User; break; case "SHA-256": if (this.CalcHash(Password) == User.PasswordHash) return User; break; default: Log.Error("Unsupported Hash function: " + User.PasswordHashType); ...Read now
Unlock full access