Example #1
0
        public EAuthRequestViewModel CreateRequestAsync(string requestUrl, string callbackUrl, string serviceOid, string providerOid,
                                                        string signatureNsPrefix, bool includePublicKey, string sslCertificateThumbprint)
        {
            XmlDocument doc = EAuthPersonUtil.CreateSamlRequest(
                _eAuthUrl, ThisSystem.Oid, ThisSystem.Name, ThisSystem.Name, requestUrl, callbackUrl, serviceOid, providerOid,
                signatureNsPrefix, includePublicKey, sslCertificateThumbprint, out string requestId);

            string samlRequest = doc.OuterXml;
            string relayState  = null;

            SignUtil.Status signatureStatus = SignUtil.ValidateText(samlRequest);

            return(new EAuthRequestViewModel
            {
                RequestId = requestId,
                // Полета, необходими за скритата форма, която се POST-ва към еАвт.
                EAuthUrl = _eAuthUrl,
                SAMLRequest = EncodeSamlParameter(samlRequest),
                RelayState = EncodeSamlParameter(relayState),
                // Допълнителни полета за потребителя и за debug цели.
                SamlRequestBeautified = XmlUtil.BeautifyXml(samlRequest),
                SamlRequestDecoded = samlRequest,
                RelayStateDecoded = relayState,
                SignatureStatusName = SignUtil.FormatStatus(signatureStatus)
            });
        }