コード例 #1
0
        public override bool Equals(object obj)
        {
            PhotobucketToken token = obj as PhotobucketToken;

            return(Token.Equals(token.Token) && TokenSecret.Equals(token.TokenSecret));
        }
コード例 #2
0
        public string GenerateURL(string authedBaseUrl, string relativeUrl, string httpMethod, PhotobucketToken token, QueryParameterList paramaters)
        {
            if (string.IsNullOrEmpty(authedBaseUrl))
            {
                authedBaseUrl = _baseUrl;
            }

            if (string.IsNullOrEmpty(httpMethod))
            {
                throw new ArgumentNullException("httpMethod empty");
            }

            QueryParameterList realParamaters = GenerateOAuthParamaters(relativeUrl, httpMethod, token, paramaters);

            string normalizedRequestParameters = realParamaters.NormalizeRequestParameters();

            string finalUrl = authedBaseUrl + relativeUrl + "?" + normalizedRequestParameters;

            return(finalUrl);
        }
コード例 #3
0
        public QueryParameterList GenerateOAuthParamaters(string relativeUrl, string httpMethod, PhotobucketToken token, QueryParameterList paramaters)
        {
            string nonce     = GenerateNonce( );
            string timestamp = GenerateTimeStamp( );

            if (paramaters == null)
            {
                paramaters = new QueryParameterList( );
            }

            paramaters.Add(new QueryParameter(OAuthVersionKey, OAuthVersion));
            paramaters.Add(new QueryParameter(OAuthNonceKey, nonce));
            paramaters.Add(new QueryParameter(OAuthTimestampKey, timestamp));
            paramaters.Add(new QueryParameter(OAuthSignatureMethodKey, HMACSHA1SignatureType));
            paramaters.Add(new QueryParameter(OAuthConsumerKeyKey, _apiKey));

            if (!string.IsNullOrEmpty(token.Token))
            {
                paramaters.Add(new QueryParameter(OAuthTokenKey, token.Token));
            }

            string signature = GenerateHashedSignature(relativeUrl, httpMethod, token.TokenSecret, timestamp, nonce, paramaters);

            paramaters.Add(new QueryParameter(OAuthSignatureKey, UrlEncode(signature)));

            paramaters.Sort( );

            return(paramaters);
        }
コード例 #4
0
 public string GenerateURL(string authedBaseUrl, string relativeUrl, string httpMethod, PhotobucketToken token)
 {
     return(GenerateURL(authedBaseUrl, relativeUrl, httpMethod, token, null));
 }