O'Reilly logo

Mastering Internet of Things by Peter Waher

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Creating our user

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; ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required