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 #ifndef REMOTING_HOST_TOKEN_VALIDATOR_BASE_H_ | 5 #ifndef REMOTING_HOST_TOKEN_VALIDATOR_BASE_H_ |
6 #define REMOTING_HOST_TOKEN_VALIDATOR_BASE_H_ | 6 #define REMOTING_HOST_TOKEN_VALIDATOR_BASE_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
12 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
13 #include "net/url_request/url_request.h" | 13 #include "net/url_request/url_request.h" |
14 #include "net/url_request/url_request_context_getter.h" | 14 #include "net/url_request/url_request_context_getter.h" |
15 #include "remoting/host/third_party_auth_config.h" | 15 #include "remoting/host/third_party_auth_config.h" |
16 #include "remoting/protocol/token_validator.h" | 16 #include "remoting/protocol/token_validator.h" |
17 #include "url/gurl.h" | 17 #include "url/gurl.h" |
18 | 18 |
19 namespace net { | 19 namespace net { |
20 class ClientCertStore; | 20 class ClientCertStore; |
21 typedef std::vector<scoped_refptr<X509Certificate> > CertificateList; | 21 class ClientCertIdentity; |
| 22 using ClientCertIdentityList = std::vector<std::unique_ptr<ClientCertIdentity>>; |
22 } | 23 } |
23 | 24 |
24 namespace remoting { | 25 namespace remoting { |
25 | 26 |
26 class TokenValidatorBase | 27 class TokenValidatorBase |
27 : public net::URLRequest::Delegate, | 28 : public net::URLRequest::Delegate, |
28 public protocol::TokenValidator { | 29 public protocol::TokenValidator { |
29 public: | 30 public: |
30 TokenValidatorBase( | 31 TokenValidatorBase( |
31 const ThirdPartyAuthConfig& third_party_auth_config, | 32 const ThirdPartyAuthConfig& third_party_auth_config, |
(...skipping 15 matching lines...) Expand all Loading... |
47 void OnReadCompleted(net::URLRequest* source, int net_result) override; | 48 void OnReadCompleted(net::URLRequest* source, int net_result) override; |
48 void OnReceivedRedirect(net::URLRequest* request, | 49 void OnReceivedRedirect(net::URLRequest* request, |
49 const net::RedirectInfo& redirect_info, | 50 const net::RedirectInfo& redirect_info, |
50 bool* defer_redirect) override; | 51 bool* defer_redirect) override; |
51 void OnCertificateRequested( | 52 void OnCertificateRequested( |
52 net::URLRequest* source, | 53 net::URLRequest* source, |
53 net::SSLCertRequestInfo* cert_request_info) override; | 54 net::SSLCertRequestInfo* cert_request_info) override; |
54 | 55 |
55 protected: | 56 protected: |
56 void OnCertificatesSelected(net::ClientCertStore* unused, | 57 void OnCertificatesSelected(net::ClientCertStore* unused, |
57 net::CertificateList selected_certs); | 58 net::ClientCertIdentityList selected_certs); |
58 | 59 |
59 virtual void StartValidateRequest(const std::string& token) = 0; | 60 virtual void StartValidateRequest(const std::string& token) = 0; |
60 virtual void ContinueWithCertificate(net::X509Certificate* client_cert, | 61 virtual void ContinueWithCertificate( |
61 net::SSLPrivateKey* client_private_key); | 62 scoped_refptr<net::X509Certificate> client_cert, |
| 63 scoped_refptr<net::SSLPrivateKey> client_private_key); |
62 virtual bool IsValidScope(const std::string& token_scope); | 64 virtual bool IsValidScope(const std::string& token_scope); |
63 std::string ProcessResponse(int net_result); | 65 std::string ProcessResponse(int net_result); |
64 | 66 |
65 // Constructor parameters. | 67 // Constructor parameters. |
66 ThirdPartyAuthConfig third_party_auth_config_; | 68 ThirdPartyAuthConfig third_party_auth_config_; |
67 std::string token_scope_; | 69 std::string token_scope_; |
68 scoped_refptr<net::URLRequestContextGetter> request_context_getter_; | 70 scoped_refptr<net::URLRequestContextGetter> request_context_getter_; |
69 | 71 |
70 // URLRequest related fields. | 72 // URLRequest related fields. |
71 std::unique_ptr<net::URLRequest> request_; | 73 std::unique_ptr<net::URLRequest> request_; |
(...skipping 15 matching lines...) Expand all Loading... |
87 base::Callback<void(const std::string& shared_secret)> on_token_validated_; | 89 base::Callback<void(const std::string& shared_secret)> on_token_validated_; |
88 | 90 |
89 base::WeakPtrFactory<TokenValidatorBase> weak_factory_; | 91 base::WeakPtrFactory<TokenValidatorBase> weak_factory_; |
90 | 92 |
91 DISALLOW_COPY_AND_ASSIGN(TokenValidatorBase); | 93 DISALLOW_COPY_AND_ASSIGN(TokenValidatorBase); |
92 }; | 94 }; |
93 | 95 |
94 } // namespace remoting | 96 } // namespace remoting |
95 | 97 |
96 #endif // REMOTING_HOST_TOKEN_VALIDATOR_BASE_H | 98 #endif // REMOTING_HOST_TOKEN_VALIDATOR_BASE_H |
OLD | NEW |