| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/base64.h" | 9 #include "base/base64.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 // cert store doesn't contain any certificates. Use the "Local Machine" | 144 // cert store doesn't contain any certificates. Use the "Local Machine" |
| 145 // store instead. | 145 // store instead. |
| 146 // The ACL on the private key of the machine certificate in the "Local | 146 // The ACL on the private key of the machine certificate in the "Local |
| 147 // Machine" cert store needs to allow access by "Local Service". | 147 // Machine" cert store needs to allow access by "Local Service". |
| 148 HCERTSTORE cert_store = ::CertOpenStore( | 148 HCERTSTORE cert_store = ::CertOpenStore( |
| 149 CERT_STORE_PROV_SYSTEM, 0, NULL, | 149 CERT_STORE_PROV_SYSTEM, 0, NULL, |
| 150 CERT_SYSTEM_STORE_LOCAL_MACHINE | CERT_STORE_READONLY_FLAG, L"MY"); | 150 CERT_SYSTEM_STORE_LOCAL_MACHINE | CERT_STORE_READONLY_FLAG, L"MY"); |
| 151 client_cert_store = new net::ClientCertStoreWin(cert_store); | 151 client_cert_store = new net::ClientCertStoreWin(cert_store); |
| 152 #elif defined(OS_MACOSX) | 152 #elif defined(OS_MACOSX) |
| 153 client_cert_store = new net::ClientCertStoreMac(); | 153 client_cert_store = new net::ClientCertStoreMac(); |
| 154 #elif defined(USE_OPENSSL) | 154 #else |
| 155 // OpenSSL does not use the ClientCertStore infrastructure. | 155 // OpenSSL does not use the ClientCertStore infrastructure. |
| 156 client_cert_store = nullptr; | 156 client_cert_store = nullptr; |
| 157 #else | |
| 158 #error Unknown platform. | |
| 159 #endif | 157 #endif |
| 160 // The callback is uncancellable, and GetClientCert requires selected_certs | 158 // The callback is uncancellable, and GetClientCert requires selected_certs |
| 161 // and client_cert_store to stay alive until the callback is called. So we | 159 // and client_cert_store to stay alive until the callback is called. So we |
| 162 // must give it a WeakPtr for |this|, and ownership of the other parameters. | 160 // must give it a WeakPtr for |this|, and ownership of the other parameters. |
| 163 net::CertificateList* selected_certs(new net::CertificateList()); | 161 net::CertificateList* selected_certs(new net::CertificateList()); |
| 164 client_cert_store->GetClientCerts( | 162 client_cert_store->GetClientCerts( |
| 165 *cert_request_info, selected_certs, | 163 *cert_request_info, selected_certs, |
| 166 base::Bind(&TokenValidatorBase::OnCertificatesSelected, | 164 base::Bind(&TokenValidatorBase::OnCertificatesSelected, |
| 167 weak_factory_.GetWeakPtr(), base::Owned(selected_certs), | 165 weak_factory_.GetWeakPtr(), base::Owned(selected_certs), |
| 168 base::Owned(client_cert_store))); | 166 base::Owned(client_cert_store))); |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 return std::string(); | 222 return std::string(); |
| 225 } | 223 } |
| 226 | 224 |
| 227 std::string shared_secret; | 225 std::string shared_secret; |
| 228 // Everything is valid, so return the shared secret to the caller. | 226 // Everything is valid, so return the shared secret to the caller. |
| 229 dict->GetStringWithoutPathExpansion("access_token", &shared_secret); | 227 dict->GetStringWithoutPathExpansion("access_token", &shared_secret); |
| 230 return shared_secret; | 228 return shared_secret; |
| 231 } | 229 } |
| 232 | 230 |
| 233 } // namespace remoting | 231 } // namespace remoting |
| OLD | NEW |