示例#1
0
        public void DeserialiseTokenTest_signed_only_assertion_read_assertion()
        {
            //ARRANGE

            var path          = FileHelper.GetSignedAssertion();
            var certValidator = new CertificateValidatorMock();
            var logger        = new LogProviderMock();
            var certManager   = new CertificateManager(logger);

            certManager.CertificateValidator = certValidator;
            var federationPartyContextBuilder = new FederationPartyContextBuilderMock();
            var xmlReader = XmlReader.Create(path);
            var reader    = XmlReader.Create(xmlReader, xmlReader.Settings);

            var tokenHandlerConfigurationProvider = new TokenHandlerConfigurationProvider(federationPartyContextBuilder, certManager);
            var configuration             = tokenHandlerConfigurationProvider.GetConfiguration("testshib");
            var saml2SecurityTokenHandler = new SecurityTokenHandlerMock();

            saml2SecurityTokenHandler.SetConfiguration(configuration);
            //ACT
            var assertion = saml2SecurityTokenHandler.GetAssertion(reader);

            //Assert
            Assert.NotNull(assertion);
        }
示例#2
0
        public void DeserialiseTokenTest_signed_only_assertion_read_assertion()
        {
            //ARRANGE

            var dirPath       = @"D:\Dan\Software\Apira\Assertions\Local\";
            var path          = FileHelper.GetLastesFile(dirPath);
            var certValidator = new CertificateValidatorMock();
            var federationPartyContextBuilder = new FederationPartyContextBuilderMock();
            var xmlReader = XmlReader.Create(path);
            var reader    = XmlReader.Create(xmlReader, xmlReader.Settings);

            var tokenHandlerConfigurationProvider = new TokenHandlerConfigurationProvider(federationPartyContextBuilder, certValidator);
            var configuration             = tokenHandlerConfigurationProvider.GetConfiguration("testshib");
            var saml2SecurityTokenHandler = new SecurityTokenHandlerMock();

            saml2SecurityTokenHandler.SetConfiguration(configuration);
            //ACT
            var assertion = saml2SecurityTokenHandler.GetAssertion(reader);

            //Assert
            Assert.NotNull(assertion);
        }