Esempio n. 1
0
 public void ThirdPartyAuthorization()
 {
     certSOAPHeaderAuthStrategy = new CertificateSOAPHeaderAuthStrategy();
     subAuthorization           = new SubjectAuthorization("testsubject");
     certSOAPHeaderAuthStrategy.ThirdPartyAuthorization = subAuthorization;
     Assert.IsNotNull(certSOAPHeaderAuthStrategy.ThirdPartyAuthorization);
 }
 public void ThirdPartyAuthorization()
 {
     certSOAPHeaderAuthStrategy = new CertificateSOAPHeaderAuthStrategy();
     subAuthorization = new SubjectAuthorization("testsubject");
     certSOAPHeaderAuthStrategy.ThirdPartyAuthorization = subAuthorization;
     Assert.IsNotNull(certSOAPHeaderAuthStrategy.ThirdPartyAuthorization);
 }
 public void GenerateHeaderStrategyToken()
 {
     certCredential = new CertificateCredential("testusername", "testpassword", "sdk-cert.p12", "KJAERUGBLVF6Y");
     certSOAPHeaderAuthStrategy = new CertificateSOAPHeaderAuthStrategy();
     TokenAuthorization toknAuthorization = new TokenAuthorization("accessToken", "tokenSecret");
     certSOAPHeaderAuthStrategy.ThirdPartyAuthorization = toknAuthorization;
     string payload = certSOAPHeaderAuthStrategy.GenerateHeaderStrategy(certCredential);
     Assert.AreEqual("<ns:RequesterCredentials/>", payload);
 }
Esempio n. 4
0
        public void GenerateHeaderStrategyToken()
        {
            certCredential             = new CertificateCredential("testusername", "testpassword", "sdk-cert.p12", "KJAERUGBLVF6Y");
            certSOAPHeaderAuthStrategy = new CertificateSOAPHeaderAuthStrategy();
            TokenAuthorization toknAuthorization = new TokenAuthorization("accessToken", "tokenSecret");

            certSOAPHeaderAuthStrategy.ThirdPartyAuthorization = toknAuthorization;
            string payload = certSOAPHeaderAuthStrategy.GenerateHeaderStrategy(certCredential);

            Assert.AreEqual("<ns:RequesterCredentials/>", payload);
        }
 public void GenerateHeaderStrategy()
 {
     certCredential = new CertificateCredential("testusername", "testpassword", "sdk-cert.p12", "KJAERUGBLVF6Y");
     certSOAPHeaderAuthStrategy = new CertificateSOAPHeaderAuthStrategy();
     string payload = certSOAPHeaderAuthStrategy.GenerateHeaderStrategy(certCredential);
     XmlDocument xmlDoc = GetXmlDocument(payload);
     XmlNodeList xmlNodeListUsername = xmlDoc.GetElementsByTagName("Username");
     Assert.IsTrue(xmlNodeListUsername.Count > 0);
     Assert.AreEqual("testusername", xmlNodeListUsername[0].InnerXml);
     XmlNodeList xmlNodeListPassword = xmlDoc.GetElementsByTagName("Password");
     Assert.IsTrue(xmlNodeListPassword.Count > 0);
     Assert.AreEqual("testpassword", xmlNodeListPassword[0].InnerXml);
 }
Esempio n. 6
0
        public void GenerateHeaderStrategy()
        {
            certCredential             = new CertificateCredential("testusername", "testpassword", "sdk-cert.p12", "KJAERUGBLVF6Y");
            certSOAPHeaderAuthStrategy = new CertificateSOAPHeaderAuthStrategy();
            string      payload             = certSOAPHeaderAuthStrategy.GenerateHeaderStrategy(certCredential);
            XmlDocument xmlDoc              = GetXmlDocument(payload);
            XmlNodeList xmlNodeListUsername = xmlDoc.GetElementsByTagName("Username");

            Assert.IsTrue(xmlNodeListUsername.Count > 0);
            Assert.AreEqual("testusername", xmlNodeListUsername[0].InnerXml);
            XmlNodeList xmlNodeListPassword = xmlDoc.GetElementsByTagName("Password");

            Assert.IsTrue(xmlNodeListPassword.Count > 0);
            Assert.AreEqual("testpassword", xmlNodeListPassword[0].InnerXml);
        }
        /// <summary>
        /// Appends SOAP Headers to payload 
        /// if the credentials mandate soap headers
        /// </summary>
        /// <returns></returns>
        public string GetPayLoad()
        {
            if (payLoad == null)
            {
                payLoad = apiCallHandler.GetPayLoad();
                string header = null;
                if (credential is SignatureCredential)
                {
                    SignatureCredential signCredential = (SignatureCredential) credential;
                    SignatureSOAPHeaderAuthStrategy signSoapHeaderAuthStrategy = new SignatureSOAPHeaderAuthStrategy();
                    signSoapHeaderAuthStrategy.ThirdPartyAuthorization = signCredential.ThirdPartyAuthorization;
                    header = signSoapHeaderAuthStrategy.GenerateHeaderStrategy(signCredential);
                }
                else if (credential is CertificateCredential)
                {
                    CertificateCredential certCredential = (CertificateCredential) credential;
                    CertificateSOAPHeaderAuthStrategy certSoapHeaderAuthStrategy = new CertificateSOAPHeaderAuthStrategy();
                    certSoapHeaderAuthStrategy.ThirdPartyAuthorization = certCredential.ThirdPartyAuthorization;
                    header = certSoapHeaderAuthStrategy.GenerateHeaderStrategy(certCredential);

                }
                payLoad = GetPayLoadUsingSOAPHeader(payLoad, GetAttributeNamespace(), header);
            }
            return payLoad;
        }