OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_base.h" | 5 #include "remoting/host/token_validator_base.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" |
11 #include "base/logging.h" | 11 #include "base/logging.h" |
12 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
13 #include "base/single_thread_task_runner.h" | 13 #include "base/single_thread_task_runner.h" |
14 #include "base/strings/string_util.h" | 14 #include "base/strings/string_util.h" |
15 #include "base/values.h" | 15 #include "base/values.h" |
16 #include "net/base/escape.h" | 16 #include "net/base/escape.h" |
17 #include "net/base/io_buffer.h" | 17 #include "net/base/io_buffer.h" |
18 #include "net/base/request_priority.h" | 18 #include "net/base/request_priority.h" |
19 #include "net/base/upload_bytes_element_reader.h" | 19 #include "net/base/upload_bytes_element_reader.h" |
20 #include "net/base/upload_data_stream.h" | 20 #include "net/base/upload_data_stream.h" |
21 #include "net/ssl/client_cert_store.h" | 21 #include "net/ssl/client_cert_store.h" |
22 #if defined(USE_NSS) | 22 #if defined(USE_NSS_CERTS) |
23 #include "net/ssl/client_cert_store_nss.h" | 23 #include "net/ssl/client_cert_store_nss.h" |
24 #elif defined(OS_WIN) | 24 #elif defined(OS_WIN) |
25 #include "net/ssl/client_cert_store_win.h" | 25 #include "net/ssl/client_cert_store_win.h" |
26 #elif defined(OS_MACOSX) | 26 #elif defined(OS_MACOSX) |
27 #include "net/ssl/client_cert_store_mac.h" | 27 #include "net/ssl/client_cert_store_mac.h" |
28 #endif | 28 #endif |
29 #include "net/ssl/ssl_cert_request_info.h" | 29 #include "net/ssl/ssl_cert_request_info.h" |
30 #include "net/url_request/url_request.h" | 30 #include "net/url_request/url_request.h" |
31 #include "net/url_request/url_request_context.h" | 31 #include "net/url_request/url_request_context.h" |
32 #include "net/url_request/url_request_status.h" | 32 #include "net/url_request/url_request_status.h" |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 on_token_validated_.Run(shared_token); | 106 on_token_validated_.Run(shared_token); |
107 } | 107 } |
108 } | 108 } |
109 | 109 |
110 void TokenValidatorBase::OnCertificateRequested( | 110 void TokenValidatorBase::OnCertificateRequested( |
111 net::URLRequest* source, | 111 net::URLRequest* source, |
112 net::SSLCertRequestInfo* cert_request_info) { | 112 net::SSLCertRequestInfo* cert_request_info) { |
113 DCHECK_EQ(request_.get(), source); | 113 DCHECK_EQ(request_.get(), source); |
114 | 114 |
115 net::ClientCertStore* client_cert_store; | 115 net::ClientCertStore* client_cert_store; |
116 #if defined(USE_NSS) | 116 #if defined(USE_NSS_CERTS) |
117 client_cert_store = new net::ClientCertStoreNSS( | 117 client_cert_store = new net::ClientCertStoreNSS( |
118 net::ClientCertStoreNSS::PasswordDelegateFactory()); | 118 net::ClientCertStoreNSS::PasswordDelegateFactory()); |
119 #elif defined(OS_WIN) | 119 #elif defined(OS_WIN) |
120 client_cert_store = new net::ClientCertStoreWin(); | 120 client_cert_store = new net::ClientCertStoreWin(); |
121 #elif defined(OS_MACOSX) | 121 #elif defined(OS_MACOSX) |
122 client_cert_store = new net::ClientCertStoreMac(); | 122 client_cert_store = new net::ClientCertStoreMac(); |
123 #elif defined(USE_OPENSSL) | 123 #elif defined(USE_OPENSSL) |
124 // OpenSSL does not use the ClientCertStore infrastructure. | 124 // OpenSSL does not use the ClientCertStore infrastructure. |
125 client_cert_store = nullptr; | 125 client_cert_store = nullptr; |
126 #else | 126 #else |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 return std::string(); | 191 return std::string(); |
192 } | 192 } |
193 | 193 |
194 std::string shared_secret; | 194 std::string shared_secret; |
195 // Everything is valid, so return the shared secret to the caller. | 195 // Everything is valid, so return the shared secret to the caller. |
196 dict->GetStringWithoutPathExpansion("access_token", &shared_secret); | 196 dict->GetStringWithoutPathExpansion("access_token", &shared_secret); |
197 return shared_secret; | 197 return shared_secret; |
198 } | 198 } |
199 | 199 |
200 } // namespace remoting | 200 } // namespace remoting |
OLD | NEW |