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 <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
| 9 #include <utility> |
| 10 |
9 #include "base/base64.h" | 11 #include "base/base64.h" |
10 #include "base/bind.h" | 12 #include "base/bind.h" |
11 #include "base/callback.h" | 13 #include "base/callback.h" |
12 #include "base/json/json_reader.h" | 14 #include "base/json/json_reader.h" |
13 #include "base/logging.h" | 15 #include "base/logging.h" |
14 #include "base/macros.h" | 16 #include "base/macros.h" |
15 #include "base/single_thread_task_runner.h" | 17 #include "base/single_thread_task_runner.h" |
16 #include "base/strings/string_util.h" | 18 #include "base/strings/string_util.h" |
17 #include "base/values.h" | 19 #include "base/values.h" |
18 #include "crypto/random.h" | 20 #include "crypto/random.h" |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 third_party_auth_config_.token_validation_url, net::DEFAULT_PRIORITY, | 89 third_party_auth_config_.token_validation_url, net::DEFAULT_PRIORITY, |
88 this); | 90 this); |
89 request_->SetExtraRequestHeaderByName( | 91 request_->SetExtraRequestHeaderByName( |
90 net::HttpRequestHeaders::kContentType, | 92 net::HttpRequestHeaders::kContentType, |
91 "application/x-www-form-urlencoded", true); | 93 "application/x-www-form-urlencoded", true); |
92 request_->set_method("POST"); | 94 request_->set_method("POST"); |
93 scoped_ptr<net::UploadElementReader> reader( | 95 scoped_ptr<net::UploadElementReader> reader( |
94 new net::UploadBytesElementReader( | 96 new net::UploadBytesElementReader( |
95 post_body_.data(), post_body_.size())); | 97 post_body_.data(), post_body_.size())); |
96 request_->set_upload( | 98 request_->set_upload( |
97 net::ElementsUploadDataStream::CreateWithReader(reader.Pass(), 0)); | 99 net::ElementsUploadDataStream::CreateWithReader(std::move(reader), 0)); |
98 request_->Start(); | 100 request_->Start(); |
99 } | 101 } |
100 | 102 |
101 std::string TokenValidatorImpl::CreateScope( | 103 std::string TokenValidatorImpl::CreateScope( |
102 const std::string& local_jid, | 104 const std::string& local_jid, |
103 const std::string& remote_jid) { | 105 const std::string& remote_jid) { |
104 std::string nonce_bytes; | 106 std::string nonce_bytes; |
105 crypto::RandBytes(base::WriteInto(&nonce_bytes, kNonceLength + 1), | 107 crypto::RandBytes(base::WriteInto(&nonce_bytes, kNonceLength + 1), |
106 kNonceLength); | 108 kNonceLength); |
107 std::string nonce; | 109 std::string nonce; |
(...skipping 17 matching lines...) Expand all Loading... |
125 TokenValidatorFactoryImpl::CreateTokenValidator( | 127 TokenValidatorFactoryImpl::CreateTokenValidator( |
126 const std::string& local_jid, | 128 const std::string& local_jid, |
127 const std::string& remote_jid) { | 129 const std::string& remote_jid) { |
128 return make_scoped_ptr( | 130 return make_scoped_ptr( |
129 new TokenValidatorImpl(third_party_auth_config_, | 131 new TokenValidatorImpl(third_party_auth_config_, |
130 key_pair_, local_jid, remote_jid, | 132 key_pair_, local_jid, remote_jid, |
131 request_context_getter_)); | 133 request_context_getter_)); |
132 } | 134 } |
133 | 135 |
134 } // namespace remoting | 136 } // namespace remoting |
OLD | NEW |