예제 #1
0
        public static IDictionary <string, string> getAccessToken(string issuerId, X509Certificate2 certificate, string consumerKey, string subject)
        {
            string[] strArray = FixedSamlUtils.getSamlResponse(issuerId, certificate, consumerKey, subject).Split(new char[2]
            {
                '&',
                '='
            });
            IDictionary <string, string> dictionary = (IDictionary <string, string>) new Dictionary <string, string>();

            dictionary[strArray[0]] = strArray[1];
            dictionary[strArray[2]] = strArray[3];
            return(dictionary);
        }
예제 #2
0
        public void Authorize(WebRequest webRequest, string requestBody)
        {
            if (this.OauthValidator == null)
            {
                // Use the FixedSamlUtils instead of the standard Intuit SamlUtils
                IDictionary <string, string> accessToken = FixedSamlUtils.getAccessToken(
                    this.IssuerId,
                    this.Certificate,
                    this.ConsumerKey,
                    this.Subject);
                this.OauthValidator = new OAuthRequestValidator(
                    accessToken["oauth_token"],
                    accessToken["oauth_token_secret"],
                    this.ConsumerKey,
                    this.ConsumerSecret);
            }

            this.OauthValidator.Authorize(webRequest, requestBody);
        }
예제 #3
0
        public static string getSamlResponse(string issuerId, X509Certificate2 certificate, string consumerKey, string subject)
        {
            string requestDataEncoded = SamlHelper.Encode64(SamlHelper.CreateSamlAssertion(issuerId, issuerId, subject, certificate));

            return(FixedSamlUtils.PostSamlAssertion(consumerKey, requestDataEncoded));
        }