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