예제 #1
0
        public void LogoutRequestType_test_test()
        {
            //ARRANGE
            var requestUri = new Uri("http://localhost:59611/");
            var federationPartyContextBuilder = new FederationPartyContextBuilderMock();
            var federationContex    = federationPartyContextBuilder.BuildContext("local");
            var logoutContext       = new SamlLogoutContext(new Uri(Reasons.User), new System.IdentityModel.Tokens.Saml2NameIdentifier("testUser", new Uri(NameIdentifierFormats.Persistent)), "local");
            var authnRequestContext = new LogoutRequestContext(requestUri, new Uri("http://localhost"), federationContex, logoutContext);
            var types         = ReflectionHelper.GetAllTypes(t => !t.IsAbstract && !t.IsInterface && typeof(RequestAbstract).IsAssignableFrom(t));
            var xmlSerialiser = new XMLSerialiser();
            var compressor    = new DeflateCompressor();
            var encoder       = new MessageEncoding(compressor);
            var logger        = new LogProviderMock();
            var serialiser    = new RequestSerialiser(xmlSerialiser, encoder, logger) as IRequestSerialiser;

            RequestHelper.GetAuthnRequestBuilders = AuthnRequestBuildersFactoryMock.GetLogoutRequestBuildersFactory();
            var logoutRequest = RequestHelper.BuildRequest(authnRequestContext);
            var typeResolver  = new MessageTypeResolver();
            //ACT
            var serialised = serialiser.Serialize(logoutRequest);
            var type       = typeResolver.ResolveMessageType(serialised, types);

            //ASSERT

            Assert.AreEqual(typeof(LogoutRequest), type);
        }
        public static async Task <Uri> BuildLogoutRequestRedirectUrl()
        {
            var requestUri = new Uri("http://localhost:59611/");
            var federationPartyContextBuilder = new FederationPartyContextBuilderMock();
            var federationContex = federationPartyContextBuilder.BuildContext("local");
            var supportedNameIdentifierFormats = new List <Uri> {
                new Uri(NameIdentifierFormats.Transient)
            };
            var logoutContext       = new SamlLogoutContext(new Uri(Reasons.User), new System.IdentityModel.Tokens.Saml2NameIdentifier("testUser", new Uri(NameIdentifierFormats.Persistent)), "local");
            var authnRequestContext = new LogoutRequestContext(requestUri, new Uri("http://localhost"), federationContex, logoutContext);
            var bindingContext      = await SamlRedirectRequestProviderMock.BuildRequestBindingContext(authnRequestContext);

            return(bindingContext.GetDestinationUrl());
        }
 public LogoutRequestContext(Uri destination, Uri origin, FederationPartyConfiguration federationPartyContext, SamlLogoutContext samlLogoutContext)
     : base(destination, origin, federationPartyContext)
 {
     this.SamlLogoutContext = samlLogoutContext;
 }
 public OwinLogoutRequestContext(IOwinContext context, Uri destination, Uri origin, FederationPartyConfiguration federationPartyContext, SamlLogoutContext samlLogoutContext)
     : base(destination, origin, federationPartyContext, samlLogoutContext)
 {
 }