public void CanAuthenticateAnonymousDevice()
        {
            OverlordIdentity.InitializeAnonymousIdentity();
            AzureStorage storage = new AzureStorage();

            Assert.True(storage.AuthenticateAnonymousDevice(TestData.device_01_id.UrnToId(),
                                                            TestData.device_01_token));
            Assert.False(OverlordIdentity.HasClaim(Authentication.Role, UserRole.Anonymous));
            Assert.True(OverlordIdentity.HasClaim(Authentication.Role, UserRole.Device));
        }
Example #2
0
 public void CanInitializeIdentity()
 {
     Assert.False(OverlordIdentity.HasClaim(Authentication.Role, UserRole.Anonymous));
     OverlordIdentity.InitializeAnonymousIdentity();
     Assert.True(OverlordIdentity.HasClaim(Authentication.Role, UserRole.Anonymous));
     OverlordIdentity.InitializeDeviceIdentity(TestData.device_01_id.UrnToId(), TestData.device_01_token, new string[0]);
     Assert.False(OverlordIdentity.HasClaim(Authentication.Role, UserRole.Anonymous));
     Assert.True(OverlordIdentity.HasClaim(Authentication.Role, UserRole.Device));
     OverlordIdentity.InitializeUserIdentity(TestData.user_01_id.UrnToId(), TestData.user_01_token, new string[0]);
     Assert.False(OverlordIdentity.HasClaim(Authentication.Role, UserRole.Device));
     Assert.True(OverlordIdentity.HasClaim(Authentication.Role, UserRole.User));
 }