OLD | NEW |
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 "base/base64.h" | 7 #include "base/base64.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "base/json/json_reader.h" | 10 #include "base/json/json_reader.h" |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 void TokenValidatorImpl::StartValidateRequest(const std::string& token) { | 75 void TokenValidatorImpl::StartValidateRequest(const std::string& token) { |
76 post_body_ = "code=" + net::EscapeUrlEncodedData(token, true) + | 76 post_body_ = "code=" + net::EscapeUrlEncodedData(token, true) + |
77 "&client_id=" + net::EscapeUrlEncodedData( | 77 "&client_id=" + net::EscapeUrlEncodedData( |
78 key_pair_->GetPublicKey(), true) + | 78 key_pair_->GetPublicKey(), true) + |
79 "&client_secret=" + net::EscapeUrlEncodedData( | 79 "&client_secret=" + net::EscapeUrlEncodedData( |
80 key_pair_->SignMessage(token), true) + | 80 key_pair_->SignMessage(token), true) + |
81 "&grant_type=authorization_code"; | 81 "&grant_type=authorization_code"; |
82 | 82 |
83 request_ = request_context_getter_->GetURLRequestContext()->CreateRequest( | 83 request_ = request_context_getter_->GetURLRequestContext()->CreateRequest( |
84 third_party_auth_config_.token_validation_url, net::DEFAULT_PRIORITY, | 84 third_party_auth_config_.token_validation_url, net::DEFAULT_PRIORITY, |
85 this, NULL); | 85 this, nullptr); |
86 request_->SetExtraRequestHeaderByName( | 86 request_->SetExtraRequestHeaderByName( |
87 net::HttpRequestHeaders::kContentType, | 87 net::HttpRequestHeaders::kContentType, |
88 "application/x-www-form-urlencoded", true); | 88 "application/x-www-form-urlencoded", true); |
89 request_->set_method("POST"); | 89 request_->set_method("POST"); |
90 scoped_ptr<net::UploadElementReader> reader( | 90 scoped_ptr<net::UploadElementReader> reader( |
91 new net::UploadBytesElementReader( | 91 new net::UploadBytesElementReader( |
92 post_body_.data(), post_body_.size())); | 92 post_body_.data(), post_body_.size())); |
93 request_->set_upload( | 93 request_->set_upload( |
94 net::ElementsUploadDataStream::CreateWithReader(reader.Pass(), 0)); | 94 net::ElementsUploadDataStream::CreateWithReader(reader.Pass(), 0)); |
95 request_->Start(); | 95 request_->Start(); |
(...skipping 25 matching lines...) Expand all Loading... |
121 TokenValidatorFactoryImpl::CreateTokenValidator( | 121 TokenValidatorFactoryImpl::CreateTokenValidator( |
122 const std::string& local_jid, | 122 const std::string& local_jid, |
123 const std::string& remote_jid) { | 123 const std::string& remote_jid) { |
124 return make_scoped_ptr( | 124 return make_scoped_ptr( |
125 new TokenValidatorImpl(third_party_auth_config_, | 125 new TokenValidatorImpl(third_party_auth_config_, |
126 key_pair_, local_jid, remote_jid, | 126 key_pair_, local_jid, remote_jid, |
127 request_context_getter_)); | 127 request_context_getter_)); |
128 } | 128 } |
129 | 129 |
130 } // namespace remoting | 130 } // namespace remoting |
OLD | NEW |