Example #1
0
        public void GivenSupportUserHasAccess_WhenAuthenticateSupportUser_ThenVerifyMapOptions()
        {
            //Act
            var result = SupportUserExtensions.UseSupportConsoleAuthentication(sut, supportConsoleAuthenticationOptions) as TestAppBuilder;

            //Assert
            var mapOptions = result.MiddlewareOptions.OfType <Microsoft.Owin.Mapping.MapOptions>();

            Assert.IsNotNull(mapOptions.Select(i => i.PathMatch.Equals("/login")));
            Assert.IsNotNull(mapOptions.Select(i => i.PathMatch.Equals("/login/staff")));
        }
Example #2
0
        public void GivenSupportUserHasAccess_WhenAuthenticateSupportUser_ThenVerifyWsFederationAuthenticationOptions()
        {
            //Act
            var result = SupportUserExtensions.UseSupportConsoleAuthentication(sut, supportConsoleAuthenticationOptions) as TestAppBuilder;

            //Assert
            var wsFederationAuthenticationOptions = result.MiddlewareOptions.OfType <WsFederationAuthenticationOptions>().Single();

            Assert.AreEqual("Staff", wsFederationAuthenticationOptions.AuthenticationType);
            Assert.AreEqual(supportConsoleAuthenticationOptions.AdfsOptions.Wtrealm, wsFederationAuthenticationOptions.Wtrealm);
            Assert.AreEqual(supportConsoleAuthenticationOptions.AdfsOptions.MetadataAddress, wsFederationAuthenticationOptions.MetadataAddress);
            Assert.AreEqual(supportConsoleAuthenticationOptions.AdfsOptions.Wreply, wsFederationAuthenticationOptions.Wreply);
            Assert.IsNotNull(wsFederationAuthenticationOptions.Notifications);
        }
Example #3
0
        public void GivenSupportUserHasAccess_WhenAuthenticateSupportUser_ThenVerifyCookieAuthentications()
        {
            //Act
            var result = SupportUserExtensions.UseSupportConsoleAuthentication(sut, supportConsoleAuthenticationOptions) as TestAppBuilder;

            //Assert
            var cookieOptions = result.MiddlewareOptions.OfType <CookieAuthenticationOptions>();

            Assert.IsNotNull(cookieOptions.Single(i => i.AuthenticationType.Equals("Staff")));
            Assert.IsNotNull(cookieOptions.Single(i => i.AuthenticationType.Equals("Employer")));
            Assert.IsTrue(cookieOptions.Single(i => i.AuthenticationType.Equals("Staff")).SlidingExpiration);
            Assert.IsTrue(cookieOptions.Single(i => i.AuthenticationType.Equals("Employer")).SlidingExpiration);
            Assert.AreEqual(14, cookieOptions.Single(i => i.AuthenticationType.Equals("Staff")).ExpireTimeSpan.Days);
            Assert.AreEqual(10, cookieOptions.Single(i => i.AuthenticationType.Equals("Employer")).ExpireTimeSpan.Minutes);
        }