Example #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));
            }
Example #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"));
            }
Example #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"));
            }
Example #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"));
            }
Example #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);
            }
Example #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));
            }
Example #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);
            }
Example #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);
            }
Example #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));
            }
Example #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"));
            }
Example #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"));
            }
Example #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"));
            }
Example #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));
            }
Example #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);
            }