March 2018
Beginner to intermediate
410 pages
10h 40m
English
To authenticate users, we need a user database. Waher.Security defines two interfaces that we will use: IUser and IUserSource. Each user implements the first, and the user database implements the second. We will implement a very simplistic database with only one user. Full user management goes beyond the scope of this book, but such an implementation should be straightforward, using the persistence layer presented in this book.
We begin by defining our user. It will have the username MIoT and password rox:
public class User : IUser { public string UserName => "MIoT"; public string PasswordHash =>instance.CalcHash("rox"); public string PasswordHashType => "SHA-256"; public bool HasPrivilege(string Privilege) { return false; ...Read now
Unlock full access