Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions Release/include/cpprest/oauth1.h
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#define _CASA_OAUTH1_H

#include "cpprest/http_msg.h"
#include "cpprest/details/web_utilities.h"

namespace web
{
Expand Down Expand Up @@ -479,6 +480,24 @@ class oauth1_config
/// </summary>
void clear_parameters() { m_parameters_to_sign.clear(); }

/// <summary>
/// Get the web proxy object
/// </summary>
/// <returns>A reference to the web proxy object.</returns>
const web_proxy& proxy() const
{
return m_proxy;
}

/// <summary>
/// Set the web proxy object that will be used by token_from_code and token_from_refresh
/// </summary>
/// <param name="proxy">A reference to the web proxy object.</param>
void set_proxy(const web_proxy& proxy)
{
m_proxy = proxy;
}

private:
friend class web::http::client::http_client_config;
friend class web::http::oauth1::details::oauth1_handler;
Expand Down Expand Up @@ -532,6 +551,8 @@ class oauth1_config

std::map<utility::string_t, utility::string_t> m_parameters_to_sign;

web::web_proxy m_proxy;

utility::nonce_generator m_nonce_generator;
bool m_is_authorization_completed;
};
Expand Down
9 changes: 8 additions & 1 deletion Release/src/http/oauth/oauth1.cpp
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@

using namespace utility;
using web::http::client::http_client;
using web::http::client::http_client_config;
using web::http::oauth1::details::oauth1_state;
using web::http::oauth1::details::oauth1_strings;

Expand Down Expand Up @@ -281,7 +282,13 @@ pplx::task<void> oauth1_config::_request_token(oauth1_state state, bool is_temp_
req._set_base_uri(endpoint);

_authenticate_request(req, std::move(state));
http_client client(endpoint);

// configure proxy
http_client_config config;
config.set_proxy(m_proxy);

http_client client(endpoint, config);

return client.request(req)
.then([](http_response resp)
{
Expand Down