示例#1
0
        protected Saml2Request UnbindInternal(HttpRequestBase request, Saml2Request saml2RequestResponse, string messageName, X509Certificate2 signatureValidationCertificate)
        {
            base.UnbindInternal(request, saml2RequestResponse, signatureValidationCertificate);

            if (!"GET".Equals(request.HttpMethod, StringComparison.InvariantCultureIgnoreCase))
            {
                throw new InvalidSaml2BindingException("Not HTTP GET Method.");
            }

            if (!request.QueryString.AllKeys.Contains(messageName))
            {
                throw new Saml2BindingException("HTTP Query String does not contain " + messageName);
            }

            if (!request.QueryString.AllKeys.Contains(Saml2Constants.Message.Signature))
            {
                throw new Saml2BindingException("HTTP Query String does not contain " + Saml2Constants.Message.Signature);
            }

            if (!request.QueryString.AllKeys.Contains(Saml2Constants.Message.SigAlg))
            {
                throw new Saml2BindingException("HTTP Query String does not contain " + Saml2Constants.Message.SigAlg);
            }

            if (request.QueryString.AllKeys.Contains(Saml2Constants.Message.RelayState))
            {
                RelayState = request.QueryString[Saml2Constants.Message.RelayState];
            }

            SignatureAlgorithm = request.QueryString[Saml2Constants.Message.SigAlg];
            ValidateQueryStringSignature(request.Url.Query, messageName, Convert.FromBase64String(request.QueryString[Saml2Constants.Message.Signature]), signatureValidationCertificate);
            saml2RequestResponse.Read(DecompressResponse(request.QueryString[messageName]));
            XmlDocument = saml2RequestResponse.XmlDocument;
            return(saml2RequestResponse);
        }
示例#2
0
        protected Saml2Request UnbindInternal(HttpRequestBase request, Saml2Request saml2RequestResponse, string messageName, X509Certificate2 signatureValidationCertificate)
        {
            base.UnbindInternal(request, saml2RequestResponse, signatureValidationCertificate);

            if (!"POST".Equals(request.HttpMethod, StringComparison.InvariantCultureIgnoreCase))
            {
                throw new InvalidSaml2BindingException("Not HTTP POST Method.");
            }

            if (!request.Form.AllKeys.Contains(messageName))
            {
                throw new Saml2BindingException("HTTP Form does not contain " + messageName);
            }

            if (request.Form.AllKeys.Contains(Saml2Constants.Message.RelayState))
            {
                RelayState = request.Form[Saml2Constants.Message.RelayState];
            }

            saml2RequestResponse.Read(Encoding.UTF8.GetString(Convert.FromBase64String(request.Form[messageName])), true);
            XmlDocument = saml2RequestResponse.XmlDocument;
            return(saml2RequestResponse);
        }
        protected Saml2Request UnbindInternal(HttpRequestBase request, Saml2Request saml2RequestResponse, string messageName, X509Certificate2 signatureValidationCertificate)
        {
            base.UnbindInternal(request, saml2RequestResponse, signatureValidationCertificate);

            if (!"POST".Equals(request.HttpMethod, StringComparison.InvariantCultureIgnoreCase))
                throw new InvalidSaml2BindingException("Not HTTP POST Method.");

            if (!request.Form.AllKeys.Contains(messageName))
                throw new Saml2BindingException("HTTP Form does not contain " + messageName);

            if (request.Form.AllKeys.Contains(Saml2Constants.Message.RelayState))
            {
                RelayState = request.Form[Saml2Constants.Message.RelayState];
            }

            saml2RequestResponse.Read(Encoding.UTF8.GetString(Convert.FromBase64String(request.Form[messageName])), true);
            XmlDocument = saml2RequestResponse.XmlDocument;
            return saml2RequestResponse;
        }