Ejemplo n.º 1
0
        public void RedirectUrl_WithParameters_ItReturnsTheRightUrl()
        {
            MnoHelper.Environment = "production";
            MnoHelper.App.Host = "https://mysuperapp.com";
            MnoHelper.Api.Id = "app-1";

            // Build request
            Request req = new Request();

            // Build expected url
            string expectedUrl = MnoHelper.Sso.IdpUrl();
            expectedUrl += "?SAMLRequest=";
            expectedUrl += HttpUtility.UrlEncode(XmlRequestBase64Encoded(req.Id, req.IssueInstant));

            Assert.AreEqual(expectedUrl, req.RedirectUrl());
        }
Ejemplo n.º 2
0
        public void RedirectUrl_WithNoParameters_ItReturnsTheRightUrl()
        {
            MnoHelper.Environment = "production";
            MnoHelper.App.Host = "https://mysuperapp.com";
            MnoHelper.Api.Id = "app-1";

            // Build parameters
            NameValueCollection parameters = new NameValueCollection();
            parameters.Add("group_uid","someparamvalue");
            parameters.Add("someotherparam","someothervalue");

            // Build request
            Request req = new Request(parameters);

            // Build expected url
            string expectedUrl = MnoHelper.Sso.IdpUrl();
            expectedUrl += "?SAMLRequest=";
            expectedUrl += HttpUtility.UrlEncode(XmlRequestBase64Encoded(req.Id, req.IssueInstant));
            expectedUrl += "&group_uid=someparamvalue";
            expectedUrl += "&someotherparam=someothervalue";

            Assert.AreEqual(expectedUrl, req.RedirectUrl());
        }