The Waher.Security.JWT.UWP library also contains the JwtAuthentication class that authenticates web requests based on JWT tokens. We first need to define a variable for it:
private JwtAuthentication tokenAuthentication;
When we've established the device identity, which we will use as a realm, we create an instance of this authenticator (the realm allows browsers to isolate credentials between sites):
this.tokenAuthentication = new JwtAuthentication(this.deviceId, this.users, this.tokenFactory);
The authenticator references our users database to check that subjects match users in the database. It also references the token factory to validate that tokens are correctly signed. We then simply add the reference to the authenticator ...