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

Providing basic access control

The IDataSource defines a method called CanViewAsync, which allows the data source to decline access to the source unless certain prerequisites are met. For our first implementation, we will assume that anyone who has been granted access to the concentrator, also has access to the data source:

public Task<bool> CanViewAsync(RequestOrigin Caller) 
{ 
   return Task.FromResult<bool>(true); 
} 

The RequestOrigin object will contain the XMPP address (or JID) of the entity making the request to access the data source. It also contains any service, device, or user tokens used in the call. Access can be granted or rejected based on any of these identities.

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