Beispiel #1
0
 public void InvalidApplication()
 {
     data.Application = "INVALID";
     azman            = new AzManAuthorizationProvider();
     azman.Initialize(new TestAuthorizationProviderConfigurationView(data, Context));
     azman.Authorize(this.principal, authorizedTask);
 }
        public void AuthorizationFailedFires2WmiEvents()
        {
            AzManAuthorizationProvider instrumentedAzman          = new AzManAuthorizationProvider(data.StoreLocation, data.Application, data.AuditIdentifierPrefix, data.Scope);
            AuthorizationProviderInstrumentationListener listener = new AuthorizationProviderInstrumentationListener("foo", false, false, true);

            ReflectionInstrumentationBinder binder = new ReflectionInstrumentationBinder();

            binder.Bind(instrumentedAzman.GetInstrumentationEventProvider(), listener);

            using (WmiEventWatcher eventWatcher = new WmiEventWatcher(2))
            {
                bool res = instrumentedAzman.Authorize(cryptographyProviderCollection, unauthorizedTask);

                eventWatcher.WaitForEvents();

                Assert.AreEqual(2, eventWatcher.EventsReceived.Count);

                Assert.AreEqual("AuthorizationCheckPerformedEvent", eventWatcher.EventsReceived[0].ClassPath.ClassName);
                Assert.AreEqual("foo", eventWatcher.EventsReceived[0].Properties["InstanceName"].Value);
                Assert.AreEqual(cryptographyProviderCollection.Identity.Name, eventWatcher.EventsReceived[0].Properties["UserName"].Value);
                Assert.AreEqual(unauthorizedTask, eventWatcher.EventsReceived[0].Properties["TaskName"].Value);

                Assert.AreEqual("AuthorizationCheckFailedEvent", eventWatcher.EventsReceived[1].ClassPath.ClassName);
                Assert.AreEqual("foo", eventWatcher.EventsReceived[1].Properties["InstanceName"].Value);
                Assert.AreEqual(cryptographyProviderCollection.Identity.Name, eventWatcher.EventsReceived[1].Properties["UserName"].Value);
                Assert.AreEqual(unauthorizedTask, eventWatcher.EventsReceived[1].Properties["TaskName"].Value);
            }
        }
        public void AuthorizationFailedFires2WmiEvents()
        {
            AzManAuthorizationProvider instrumentedAzman = new AzManAuthorizationProvider(data.StoreLocation, data.Application, data.AuditIdentifierPrefix, data.Scope);
            AuthorizationProviderInstrumentationListener listener = new AuthorizationProviderInstrumentationListener("foo", false, false, true);

            ReflectionInstrumentationBinder binder = new ReflectionInstrumentationBinder();
            binder.Bind(instrumentedAzman.GetInstrumentationEventProvider(), listener);

            using (WmiEventWatcher eventWatcher = new WmiEventWatcher(2))
            {
                bool res = instrumentedAzman.Authorize(cryptographyProviderCollection, unauthorizedTask);

                eventWatcher.WaitForEvents();

                Assert.AreEqual(2, eventWatcher.EventsReceived.Count);

                Assert.AreEqual("AuthorizationCheckPerformedEvent", eventWatcher.EventsReceived[0].ClassPath.ClassName);
                Assert.AreEqual("foo", eventWatcher.EventsReceived[0].Properties["InstanceName"].Value);
                Assert.AreEqual(cryptographyProviderCollection.Identity.Name, eventWatcher.EventsReceived[0].Properties["UserName"].Value);
                Assert.AreEqual(unauthorizedTask, eventWatcher.EventsReceived[0].Properties["TaskName"].Value);

                Assert.AreEqual("AuthorizationCheckFailedEvent", eventWatcher.EventsReceived[1].ClassPath.ClassName);
                Assert.AreEqual("foo", eventWatcher.EventsReceived[1].Properties["InstanceName"].Value);
                Assert.AreEqual(cryptographyProviderCollection.Identity.Name, eventWatcher.EventsReceived[1].Properties["UserName"].Value);
                Assert.AreEqual(unauthorizedTask, eventWatcher.EventsReceived[1].Properties["TaskName"].Value);
            }
        }
Beispiel #4
0
        public void AuthorizedScopeTask()
        {
            data.Scope = scope;
            azman      = new AzManAuthorizationProvider(data.StoreLocation, data.Application, data.AuditIdentifierPrefix, data.Scope, new NullAuthorizationProviderInstrumentationProvider());

            string task = "Manage Extranet";
            bool   res  = azman.Authorize(cryptographyProviderCollection, task);

            Assert.IsTrue(res);
        }
        public void UnauthorizedScopeTask()
        {
            string task = "Publish Extranet";

            data.Scope = scope;
            azman      = new AzManAuthorizationProvider(data.StoreLocation, data.Application, data.AuditIdentifierPrefix, data.Scope);
            bool res = azman.Authorize(cryptographyProviderCollection, task);

            Assert.IsFalse(res);
        }
Beispiel #6
0
        public void AuthorizedScopeTask()
        {
            azman = new AzManAuthorizationProvider();
            azman.Initialize(new TestAuthorizationProviderConfigurationView(data, Context));
            string task = "Manage Extranet";

            data.Scope = scope;
            bool res = azman.Authorize(this.principal, task);

            Assert.IsTrue(res);
        }
        public void AuthorizedScopeTask()
        {
            azman = new AzManAuthorizationProvider();
            azman.Initialize(new TestAuthorizationProviderConfigurationView(data, Context));
            string task = "Manage Extranet";

            data.Scope = scope;
            bool res = azman.Authorize(this.principal, task);

            Assert.IsTrue(res);
        }
        public void AuthorizeFiresWmiEvent()
        {
            AzManAuthorizationProvider instrumentedAzman          = new AzManAuthorizationProvider(data.StoreLocation, data.Application, data.AuditIdentifierPrefix, data.Scope);
            AuthorizationProviderInstrumentationListener listener = new AuthorizationProviderInstrumentationListener("foo", false, false, true);

            ReflectionInstrumentationBinder binder = new ReflectionInstrumentationBinder();

            binder.Bind(instrumentedAzman.GetInstrumentationEventProvider(), listener);

            using (WmiEventWatcher eventWatcher = new WmiEventWatcher(1))
            {
                bool res = instrumentedAzman.Authorize(cryptographyProviderCollection, authorizedTask);

                eventWatcher.WaitForEvents();
                Thread.Sleep(500);

                Assert.AreEqual(1, eventWatcher.EventsReceived.Count);
                Assert.AreEqual("foo", eventWatcher.EventsReceived[0].Properties["InstanceName"].Value);
                Assert.AreEqual(cryptographyProviderCollection.Identity.Name, eventWatcher.EventsReceived[0].Properties["UserName"].Value);
                Assert.AreEqual(authorizedTask, eventWatcher.EventsReceived[0].Properties["TaskName"].Value);
            }
        }
        public void AuthorizedScopeTask()
        {
            data.Scope = scope;
            azman = new AzManAuthorizationProvider(data.StoreLocation, data.Application, data.AuditIdentifierPrefix, data.Scope, new NullAuthorizationProviderInstrumentationProvider());

            string task = "Manage Extranet";
            bool res = azman.Authorize(cryptographyProviderCollection, task);

            Assert.IsTrue(res);
        }
 public void InvalidApplication()
 {
     data.Application = "INVALID";
     azman = new AzManAuthorizationProvider(data.StoreLocation, data.Application, data.AuditIdentifierPrefix, data.Scope, new NullAuthorizationProviderInstrumentationProvider());
     azman.Authorize(cryptographyProviderCollection, authorizedTask);
 }
Beispiel #11
0
        public void AuthorizeTask()
        {
            bool res = azman.Authorize(cryptographyProviderCollection, authorizedTask);

            Assert.IsTrue(res);
        }
Beispiel #12
0
 public void InvalidApplication()
 {
     data.Application = "INVALID";
     azman            = new AzManAuthorizationProvider(data.StoreLocation, data.Application, data.AuditIdentifierPrefix, data.Scope, new NullAuthorizationProviderInstrumentationProvider());
     azman.Authorize(cryptographyProviderCollection, authorizedTask);
 }
Beispiel #13
0
 public void InvalidApplication()
 {
     data.Application = "INVALID";
     azman = new AzManAuthorizationProvider();
     azman.Initialize(new TestAuthorizationProviderConfigurationView(data, Context));
     azman.Authorize(this.principal, authorizedTask);
 }
        public void AuthorizeFiresWmiEvent()
        {
            AzManAuthorizationProvider instrumentedAzman = new AzManAuthorizationProvider(data.StoreLocation, data.Application, data.AuditIdentifierPrefix, data.Scope);
            AuthorizationProviderInstrumentationListener listener = new AuthorizationProviderInstrumentationListener("foo", false, false, true);

            ReflectionInstrumentationBinder binder = new ReflectionInstrumentationBinder();
            binder.Bind(instrumentedAzman.GetInstrumentationEventProvider(), listener);

            using (WmiEventWatcher eventWatcher = new WmiEventWatcher(1))
            {
                bool res = instrumentedAzman.Authorize(cryptographyProviderCollection, authorizedTask);

                eventWatcher.WaitForEvents();
				Thread.Sleep(500);

                Assert.AreEqual(1, eventWatcher.EventsReceived.Count);
                Assert.AreEqual("foo", eventWatcher.EventsReceived[0].Properties["InstanceName"].Value);
                Assert.AreEqual(cryptographyProviderCollection.Identity.Name, eventWatcher.EventsReceived[0].Properties["UserName"].Value);
                Assert.AreEqual(authorizedTask, eventWatcher.EventsReceived[0].Properties["TaskName"].Value);
            }
        }
		public void UnauthorizedScopeTask()
		{
			string task = "Publish Extranet";

			data.Scope = scope;
			azman = new AzManAuthorizationProvider(data.StoreLocation, data.Application, data.AuditIdentifierPrefix, data.Scope);
			bool res = azman.Authorize(cryptographyProviderCollection, task);

			Assert.IsFalse(res);
		}