Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(208)

Unified Diff: remoting/host/signaling_connector.cc

Issue 19796006: Support service accounts in the chromoting host. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Update python api keys help script Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « remoting/host/signaling_connector.h ('k') | remoting/protocol/me2me_host_authenticator_factory.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/host/signaling_connector.cc
diff --git a/remoting/host/signaling_connector.cc b/remoting/host/signaling_connector.cc
index 67c142fb3019e6bf5819a3b33d772d560b22f9a4..ad9fbe5dc1d45a9042df474b080ea753bc2f449c 100644
--- a/remoting/host/signaling_connector.cc
+++ b/remoting/host/signaling_connector.cc
@@ -6,6 +6,7 @@
#include "base/bind.h"
#include "base/callback.h"
+#include "base/strings/string_util.h"
#include "google_apis/google_api_keys.h"
#include "net/url_request/url_fetcher.h"
#include "net/url_request/url_request_context_getter.h"
@@ -26,9 +27,11 @@ const int kTokenUpdateTimeBeforeExpirySeconds = 60;
SignalingConnector::OAuthCredentials::OAuthCredentials(
const std::string& login_value,
- const std::string& refresh_token_value)
+ const std::string& refresh_token_value,
+ bool is_service_account)
: login(login_value),
- refresh_token(refresh_token_value) {
+ refresh_token(refresh_token_value),
+ is_service_account(is_service_account) {
}
SignalingConnector::SignalingConnector(
@@ -228,12 +231,20 @@ void SignalingConnector::RefreshOAuthToken() {
LOG(INFO) << "Refreshing OAuth token.";
DCHECK(!refreshing_oauth_token_);
+ // Service accounts use different API keys, as they use the client app flow.
+ google_apis::OAuth2Client oauth2_client;
+ if (oauth_credentials_->is_service_account) {
+ oauth2_client = google_apis::CLIENT_REMOTING_HOST;
+ } else {
+ oauth2_client = google_apis::CLIENT_REMOTING;
+ }
+
gaia::OAuthClientInfo client_info = {
- google_apis::GetOAuth2ClientID(google_apis::CLIENT_REMOTING),
- google_apis::GetOAuth2ClientSecret(google_apis::CLIENT_REMOTING),
- // Redirect URL is only used when getting tokens from auth code. It
- // is not required when getting access tokens.
- ""
+ google_apis::GetOAuth2ClientID(oauth2_client),
+ google_apis::GetOAuth2ClientSecret(oauth2_client),
+ // Redirect URL is only used when getting tokens from auth code. It
+ // is not required when getting access tokens.
+ ""
};
refreshing_oauth_token_ = true;
« no previous file with comments | « remoting/host/signaling_connector.h ('k') | remoting/protocol/me2me_host_authenticator_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698