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

Side by Side Diff: remoting/host/token_validator_factory_impl.cc

Issue 15782010: Update remoting/ and jingle/ to use scoped_refptr<T>::get() rather than implicit "operator T*" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « remoting/host/signaling_connector.cc ('k') | remoting/host/url_request_context.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "remoting/host/token_validator_factory_impl.h" 5 #include "remoting/host/token_validator_factory_impl.h"
6 6
7 #include <set> 7 #include <set>
8 8
9 #include "base/base64.h" 9 #include "base/base64.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 scoped_refptr<RsaKeyPair> key_pair, 42 scoped_refptr<RsaKeyPair> key_pair,
43 const std::string& local_jid, 43 const std::string& local_jid,
44 const std::string& remote_jid, 44 const std::string& remote_jid,
45 scoped_refptr<net::URLRequestContextGetter> request_context_getter) 45 scoped_refptr<net::URLRequestContextGetter> request_context_getter)
46 : token_url_(token_url), 46 : token_url_(token_url),
47 token_validation_url_(token_validation_url), 47 token_validation_url_(token_validation_url),
48 key_pair_(key_pair), 48 key_pair_(key_pair),
49 request_context_getter_(request_context_getter) { 49 request_context_getter_(request_context_getter) {
50 DCHECK(token_url_.is_valid()); 50 DCHECK(token_url_.is_valid());
51 DCHECK(token_validation_url_.is_valid()); 51 DCHECK(token_validation_url_.is_valid());
52 DCHECK(key_pair_); 52 DCHECK(key_pair_.get());
53 token_scope_ = CreateScope(local_jid, remote_jid); 53 token_scope_ = CreateScope(local_jid, remote_jid);
54 } 54 }
55 55
56 virtual ~TokenValidatorImpl() { 56 virtual ~TokenValidatorImpl() {
57 } 57 }
58 58
59 // TokenValidator interface. 59 // TokenValidator interface.
60 virtual void ValidateThirdPartyToken( 60 virtual void ValidateThirdPartyToken(
61 const std::string& token, 61 const std::string& token,
62 const base::Callback<void( 62 const base::Callback<void(
63 const std::string& shared_secret)>& on_token_validated) OVERRIDE { 63 const std::string& shared_secret)>& on_token_validated) OVERRIDE {
64 DCHECK(!request_); 64 DCHECK(!request_);
65 DCHECK(!on_token_validated.is_null()); 65 DCHECK(!on_token_validated.is_null());
66 66
67 on_token_validated_ = on_token_validated; 67 on_token_validated_ = on_token_validated;
68 68
69 std::string post_body = 69 std::string post_body =
70 "code=" + net::EscapeUrlEncodedData(token, true) + 70 "code=" + net::EscapeUrlEncodedData(token, true) +
71 "&client_id=" + net::EscapeUrlEncodedData( 71 "&client_id=" + net::EscapeUrlEncodedData(
72 key_pair_->GetPublicKey(), true) + 72 key_pair_->GetPublicKey(), true) +
73 "&client_secret=" + net::EscapeUrlEncodedData( 73 "&client_secret=" + net::EscapeUrlEncodedData(
74 key_pair_->SignMessage(token), true) + 74 key_pair_->SignMessage(token), true) +
75 "&grant_type=authorization_code"; 75 "&grant_type=authorization_code";
76 request_.reset(net::URLFetcher::Create( 76 request_.reset(net::URLFetcher::Create(
77 0, token_validation_url_, net::URLFetcher::POST, this)); 77 0, token_validation_url_, net::URLFetcher::POST, this));
78 request_->SetUploadData("application/x-www-form-urlencoded", post_body); 78 request_->SetUploadData("application/x-www-form-urlencoded", post_body);
79 request_->SetRequestContext(request_context_getter_); 79 request_->SetRequestContext(request_context_getter_.get());
80 request_->Start(); 80 request_->Start();
81 } 81 }
82 82
83 virtual const GURL& token_url() const OVERRIDE { 83 virtual const GURL& token_url() const OVERRIDE {
84 return token_url_; 84 return token_url_;
85 } 85 }
86 86
87 virtual const std::string& token_scope() const OVERRIDE { 87 virtual const std::string& token_scope() const OVERRIDE {
88 return token_scope_; 88 return token_scope_;
89 } 89 }
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 TokenValidatorFactoryImpl::CreateTokenValidator( 182 TokenValidatorFactoryImpl::CreateTokenValidator(
183 const std::string& local_jid, 183 const std::string& local_jid,
184 const std::string& remote_jid) { 184 const std::string& remote_jid) {
185 return scoped_ptr<protocol::ThirdPartyHostAuthenticator::TokenValidator>( 185 return scoped_ptr<protocol::ThirdPartyHostAuthenticator::TokenValidator>(
186 new TokenValidatorImpl(token_url_, token_validation_url_, key_pair_, 186 new TokenValidatorImpl(token_url_, token_validation_url_, key_pair_,
187 local_jid, remote_jid, 187 local_jid, remote_jid,
188 request_context_getter_)); 188 request_context_getter_));
189 } 189 }
190 190
191 } // namespace remoting 191 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/host/signaling_connector.cc ('k') | remoting/host/url_request_context.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698