public static OAuthRequest GenerateConsumerRequest(OAuthConfig config, Uri requestUri, NameValueCollection requestParams, HttpMethods httpMethod) { if (config == null) throw new ArgumentNullException("config"); if (requestUri == null) throw new ArgumentNullException("requestUri"); if (requestParams == null) requestParams = new NameValueCollection(); var request = new OAuthRequest(); request.requestUri = requestUri; request.config = config; request.httpMethod = httpMethod; request.requestType = RequestTypes.ConsumerRequest; // Parse any existing URI Params request.ParseUriParams(requestUri, requestParams); // Assign request params request.requestParams = requestParams; // Setup required params request.requestParams[config.OAuthConsumerKeyKey] = config.OAuthConsumerKey; return request; }
public static OAuthRequest GenerateConsumerRequest(OAuthConfig config, Uri requestUri, NameValueCollection requestParams, HttpMethods httpMethod) { if (config == null) { throw new ArgumentNullException("config"); } if (requestUri == null) { throw new ArgumentNullException("requestUri"); } if (requestParams == null) { requestParams = new NameValueCollection(); } var request = new OAuthRequest(); request.requestUri = requestUri; request.config = config; request.httpMethod = httpMethod; request.requestType = RequestTypes.ConsumerRequest; // Parse any existing URI Params request.ParseUriParams(requestUri, requestParams); // Assign request params request.requestParams = requestParams; // Setup required params request.requestParams[config.OAuthConsumerKeyKey] = config.OAuthConsumerKey; return(request); }
public NameValueCollection GetAccessToken() { if (this.Config.IsValidForAccessToken()) { var request = OAuthRequest.GenerateProtectedRequest(this.Config, this.Config.AccessTokenUri, null, OAuthRequest.HttpMethods.GET); var response = request.SendRequest(); var responseParams = HttpUtility.ParseQueryString(response); if (responseParams != null && responseParams.Count > 0) { Config.OAuthToken = (responseParams[Config.OAuthTokenKey] ?? ""); responseParams.Remove(Config.OAuthTokenKey); Config.OAuthTokenSecret = (responseParams[Config.OAuthTokenSecretKey] ?? ""); responseParams.Remove(Config.OAuthTokenSecretKey); return(responseParams); } } return(null); }
internal string SendConsumerRequest(Uri requestUri, NameValueCollection requestParams, OAuthRequest.HttpMethods httpMethod) { return OAuthRequest.GenerateConsumerRequest(this.Config, requestUri, requestParams, httpMethod).SendRequest(); }
public string SendSignedRequest(Uri requestUri, NameValueCollection requestParams, OAuthRequest.HttpMethods httpMethod) { return OAuthRequest.GenerateSignedRequest(this.Config, requestUri, requestParams, httpMethod).SendRequest(); }
public string SendProtectedRequest(Uri requestUri, NameValueCollection requestParams, OAuthRequest.HttpMethods httpMethod) { return(OAuthRequest.GenerateProtectedRequest(this.Config, requestUri, requestParams, httpMethod).SendRequest()); }
internal string SendConsumerRequest(Uri requestUri, NameValueCollection requestParams, OAuthRequest.HttpMethods httpMethod) { return(OAuthRequest.GenerateConsumerRequest(this.Config, requestUri, requestParams, httpMethod).SendRequest()); }
protected internal string SendProtectedRequest(Uri requestUri, NameValueCollection requestParams, OAuthRequest.HttpMethods httpMethod) { return oauthHandler.SendProtectedRequest(requestUri, requestParams, httpMethod); }