| 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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 third_party_auth_config_.token_validation_url, net::DEFAULT_PRIORITY, | 84 third_party_auth_config_.token_validation_url, net::DEFAULT_PRIORITY, |
| 85 this); | 85 this); |
| 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(std::move(reader), 0)); |
| 95 request_->Start(); | 95 request_->Start(); |
| 96 } | 96 } |
| 97 | 97 |
| 98 std::string TokenValidatorImpl::CreateScope( | 98 std::string TokenValidatorImpl::CreateScope( |
| 99 const std::string& local_jid, | 99 const std::string& local_jid, |
| 100 const std::string& remote_jid) { | 100 const std::string& remote_jid) { |
| 101 std::string nonce_bytes; | 101 std::string nonce_bytes; |
| 102 crypto::RandBytes(base::WriteInto(&nonce_bytes, kNonceLength + 1), | 102 crypto::RandBytes(base::WriteInto(&nonce_bytes, kNonceLength + 1), |
| 103 kNonceLength); | 103 kNonceLength); |
| 104 std::string nonce; | 104 std::string nonce; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 122 TokenValidatorFactoryImpl::CreateTokenValidator( | 122 TokenValidatorFactoryImpl::CreateTokenValidator( |
| 123 const std::string& local_jid, | 123 const std::string& local_jid, |
| 124 const std::string& remote_jid) { | 124 const std::string& remote_jid) { |
| 125 return make_scoped_ptr( | 125 return make_scoped_ptr( |
| 126 new TokenValidatorImpl(third_party_auth_config_, | 126 new TokenValidatorImpl(third_party_auth_config_, |
| 127 key_pair_, local_jid, remote_jid, | 127 key_pair_, local_jid, remote_jid, |
| 128 request_context_getter_)); | 128 request_context_getter_)); |
| 129 } | 129 } |
| 130 | 130 |
| 131 } // namespace remoting | 131 } // namespace remoting |
| OLD | NEW |