Esempio n. 1
0
            public void ValidatesPassword()
            {
                var settings = new CoreSettings();

                var accessControl = new AccessControl(settings);

                Guid token = accessControl.RegisterLocalAccessToken();

                Assert.Throws <ArgumentException>(() => accessControl.SetLocalPassword(token, ""));
                Assert.Throws <ArgumentException>(() => accessControl.SetLocalPassword(token, " "));
                Assert.Throws <ArgumentNullException>(() => accessControl.SetLocalPassword(token, null));
            }
Esempio n. 2
0
            public void ThrowsAccessExceptionOnGuestToken()
            {
                var settings = new CoreSettings();

                var accessControl = new AccessControl(settings);

                Guid token = accessControl.RegisterLocalAccessToken();

                accessControl.SetLocalPassword(token, "password123");
                accessControl.DowngradeLocalAccess(token);

                Assert.Throws <AccessException>(() => accessControl.SetLocalPassword(token, "lololol"));
            }
Esempio n. 3
0
            public void WithRemoteTokenThrowsArgumentException()
            {
                var settings      = new CoreSettings();
                var accessControl = new AccessControl(settings);

                Guid token = accessControl.RegisterRemoteAccessToken(new Guid());

                Assert.Throws <ArgumentException>(() => accessControl.SetLocalPassword(token, "password123"));
            }
Esempio n. 4
0
            public void ThrowsArgumentExceptionOnBogusAccessToken()
            {
                var settings      = new CoreSettings();
                var accessControl = new AccessControl(settings);

                Guid token = accessControl.RegisterLocalAccessToken();

                accessControl.SetLocalPassword(token, "password123");

                Assert.Throws <ArgumentException>(() => accessControl.UpgradeLocalAccess(new Guid(), "password123"));
            }
Esempio n. 5
0
            public void UpgradesToAdmin()
            {
                var settings      = new CoreSettings();
                var accessControl = new AccessControl(settings);

                Guid token = accessControl.RegisterLocalAccessToken();

                accessControl.SetLocalPassword(token, "password123");
                accessControl.UpgradeLocalAccess(token, "password123");

                accessControl.VerifyAccess(token);
            }
Esempio n. 6
0
            public void LocalSmokeTest()
            {
                var settings = new CoreSettings();

                var accessControl = new AccessControl(settings);

                Guid token = accessControl.RegisterLocalAccessToken();

                accessControl.VerifyAccess(token, false);

                accessControl.SetLocalPassword(token, "password123");
                accessControl.DowngradeLocalAccess(token);

                Assert.Throws <AccessException>(() => accessControl.VerifyAccess(token));
            }
Esempio n. 7
0
            public void SmokeTest()
            {
                var settings = new CoreSettings
                {
                    LockRemoteControl = false
                };

                var accessControl = new AccessControl(settings);

                Guid token = accessControl.RegisterLocalAccessToken();

                var permissions = accessControl.ObserveAccessPermission(token).CreateCollection();

                accessControl.SetLocalPassword(token, "password");
                accessControl.DowngradeLocalAccess(token);
                accessControl.UpgradeLocalAccess(token, "password");

                Assert.Equal(new[] { AccessPermission.Admin, AccessPermission.Guest, AccessPermission.Admin }, permissions);
            }
Esempio n. 8
0
            public void UpgradesToAdmin()
            {
                var settings = new CoreSettings();
                var accessControl = new AccessControl(settings);

                Guid token = accessControl.RegisterLocalAccessToken();

                accessControl.SetLocalPassword(token, "password123");
                accessControl.UpgradeLocalAccess(token, "password123");

                accessControl.VerifyAccess(token);
            }
Esempio n. 9
0
            public void LocalSmokeTest()
            {
                var settings = new CoreSettings();

                var accessControl = new AccessControl(settings);

                Guid token = accessControl.RegisterLocalAccessToken();

                accessControl.VerifyAccess(token, false);

                accessControl.SetLocalPassword(token, "password123");
                accessControl.DowngradeLocalAccess(token);

                Assert.Throws<AccessException>(() => accessControl.VerifyAccess(token));
            }
Esempio n. 10
0
            public void ThrowsWrongPasswordExceptionOnWrongPassword()
            {
                var settings = new CoreSettings();
                var accessControl = new AccessControl(settings);

                Guid token = accessControl.RegisterLocalAccessToken();
                accessControl.SetLocalPassword(token, "password123");

                Assert.Throws<WrongPasswordException>(() => accessControl.UpgradeLocalAccess(token, "lolol"));
            }
Esempio n. 11
0
            public void ThrowsArgumentExceptionOnBogusAccessToken()
            {
                var settings = new CoreSettings();
                var accessControl = new AccessControl(settings);

                Guid token = accessControl.RegisterLocalAccessToken();
                accessControl.SetLocalPassword(token, "password123");

                Assert.Throws<ArgumentException>(() => accessControl.UpgradeLocalAccess(new Guid(), "password123"));
            }
Esempio n. 12
0
            public void WithRemoteTokenThrowsArgumentException()
            {
                var settings = new CoreSettings();
                var accessControl = new AccessControl(settings);

                Guid token = accessControl.RegisterRemoteAccessToken(new Guid());

                Assert.Throws<ArgumentException>(() => accessControl.SetLocalPassword(token, "password123"));
            }
Esempio n. 13
0
            public void ValidatesPassword()
            {
                var settings = new CoreSettings();

                var accessControl = new AccessControl(settings);

                Guid token = accessControl.RegisterLocalAccessToken();

                Assert.Throws<ArgumentException>(() => accessControl.SetLocalPassword(token, ""));
                Assert.Throws<ArgumentException>(() => accessControl.SetLocalPassword(token, " "));
                Assert.Throws<ArgumentNullException>(() => accessControl.SetLocalPassword(token, null));
            }
Esempio n. 14
0
            public void SmokeTest()
            {
                var settings = new CoreSettings
                {
                    LockRemoteControl = false
                };

                var accessControl = new AccessControl(settings);

                Guid token = accessControl.RegisterLocalAccessToken();

                var permissions = accessControl.ObserveAccessPermission(token).CreateCollection();

                accessControl.SetLocalPassword(token, "password");
                accessControl.DowngradeLocalAccess(token);
                accessControl.UpgradeLocalAccess(token, "password");

                Assert.Equal(new[] { AccessPermission.Admin, AccessPermission.Guest, AccessPermission.Admin }, permissions);
            }