コード例 #1
0
        public void DefaulTrustPath_should_be_trust()
        {
            const string TrustPath = "/_trust";
            const string StsUrn    = "urn:aaa";

            var workflow = new ADFSWorkflow(string.Empty);

            // Act
            workflow.GetAuthenticationCookies(StsUrn, new NetworkCredential());

            // Assert
            this.tokenGetter.Received().GetToken(Arg.Any <string>(), Arg.Any <TrustVersion>(), StsUrn + TrustPath, Arg.Any <NetworkCredential>());
            this.cookieGetter.Received().GetCookieOnPremises(StsUrn + TrustPath, Arg.Any <RequestSecurityTokenResponse>());
        }
コード例 #2
0
        public void ADFSWorkflow_should_return_CookieContainer()
        {
            // Arrange
            var urnAaa      = "urn:aaa";
            var stsEndpoint = "sts";

            var cookieContainer = new CookieContainer();
            var requestSecurityTokenResponse = new RequestSecurityTokenResponse();
            var networkCredential            = new NetworkCredential();

            this.tokenGetter.GetToken(stsEndpoint, TrustVersion.WSTrustFeb2005, Arg.Is <string>(x => x.StartsWith(urnAaa)), networkCredential).Returns(requestSecurityTokenResponse);
            this.cookieGetter.GetCookieOnPremises(Arg.Is <string>(x => x.StartsWith(urnAaa)), requestSecurityTokenResponse).Returns(cookieContainer);

            var workflow = new ADFSWorkflow(stsEndpoint);

            // Act
            CookieContainer retContainer = workflow.GetAuthenticationCookies(urnAaa, networkCredential);

            // Assert
            retContainer.Should().Be(cookieContainer);
        }