public object Render(AssertionData data)
        {
            var renderReq = new ObjectRenderingRequest(data, _renderer, data);
            var rendering = _renderer.Render(renderReq);

            return(rendering);
        }
        Expectation Dequeue(AssertionData data)
        {
            if (_expectations.Count < 1)
            {
                _inner.Fail("Unexpected assertion encountered with message: {0}", string.Format(data.FormatMessage, data.FormatArgs));
            }

            var next = _expectations.Dequeue();

            return(next);
        }
Пример #3
0
        static object RenderObject(AssertionData data, object obj, IObjectRenderer renderer)
        {
            var req = new ObjectRenderingRequest(data, renderer, obj);

            // we pretty much are only doing this to clear out the cycle detector betweeen rendering different components
            var state = renderer.SaveState(req);

            try {
                return(renderer.Render(req));
            } finally {
                renderer.RestoreState(req, state);
            }
        }
        public void ProcessRequest(HttpContext context)
        {
            switch (context.Request.HttpMethod)
            {
            case "POST":
                // Checking to verify that a SAML Assertion is included
                if (context.Request.Params["SAMLResponse"] == null)
                {
                    context.Response.Redirect("ServiceProviderError.aspx");
                }

                // Checking for the intended resource
                if (context.Request.Params["RelayState"] == null)
                {
                    context.Response.Redirect("ServiceProviderError.aspx");
                }

                // pull Base 64 encoded XML saml assertion from Request and decode it
                XmlDocument SAMLXML            = new XmlDocument();
                String      SAMLResponseString = System.Text.Encoding.UTF8.GetString(
                    Convert.FromBase64String(context.Request.Params["SAMLResponse"].ToString()));
                SAMLXML.LoadXml(SAMLResponseString);

                // Validate X509 Certificate Signature
                if (!ValidateX509CertificateSignature(SAMLXML))
                {
                    context.Response.Redirect("ServiceProviderError.aspx");
                }

                // Finding
                AssertionType assertion = GetAssertionFromXMLDoc(SAMLXML);
                if (assertion.Issuer.Value == ConfigurationManager.AppSettings["CertIssuer"])
                {
                    AssertionData SSOData = new AssertionData(assertion);
                }

                // At this point any specific work that needs to be done to establish user context with
                // the SSOData should be executed before redirecting the user browser to the target
                context.Response.Redirect(context.Request.Params["RelayState"].ToString());

                break;
            }
        }
        public void ProcessRequest(HttpContext context)
        {
            switch (context.Request.HttpMethod)
            {
                case "POST":
                    // Checking to verify that a SAML Assertion is included
                    if (context.Request.Params["SAMLResponse"] == null)
                    {
                        context.Response.Redirect("ServiceProviderError.aspx");
                    }

                    // Checking for the intended resource
                    if (context.Request.Params["RelayState"] == null)
                    {
                        context.Response.Redirect("ServiceProviderError.aspx");
                    }

                    // pull Base 64 encoded XML saml assertion from Request and decode it
                    XmlDocument SAMLXML = new XmlDocument();
                    SAMLXML.LoadXml(System.Text.Encoding.UTF8.GetString(Convert.FromBase64String(context.Request.Params["SAMLResponse"].ToString())));

                    // Validate X509 Certificate Signature
                    if (!ValidateX509CertificateSignature(SAMLXML)) context.Response.Redirect("ServiceProviderError.aspx");

                    // Finding
                    AssertionType assertion = GetAssertionFromXMLDoc(SAMLXML);
                    if (assertion.Issuer.Value == ConfigurationManager.AppSettings["CertIssuer"])
                    {
                        AssertionData SSOData = new AssertionData(assertion);
                    }

                    // At this point any specific work that needs to be done to establish user context with
                    // the SSOData should be executed before redirecting the user browser to the target
                    context.Response.Redirect(context.Request.Params["RelayState"].ToString());

                    break;
            }
        }
 public ObjectRenderingContext(AssertionData assertion, IObjectRenderer renderer)
 {
     Assertion = assertion;
     Renderer  = renderer;
 }
 public ObjectRenderingRequest(AssertionData assertion, IObjectRenderer renderer, object renderTarget)
     : base(assertion, renderer)
 {
     RenderTarget = renderTarget;
 }
 public void Check(IAssertionTool assert, AssertionData data)
 {
     DoTests(assert, this, data);
     assert.AreEqual(() => this.ExpectedAssertionType, data.GetType(), "Expected assertion should be same type");
 }