| 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 "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
| 10 #include "net/url_request/url_request.h" | 10 #include "net/url_request/url_request.h" |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 }; | 34 }; |
| 35 | 35 |
| 36 class TokenValidatorBase | 36 class TokenValidatorBase |
| 37 : public net::URLRequest::Delegate, | 37 : public net::URLRequest::Delegate, |
| 38 public protocol::TokenValidator { | 38 public protocol::TokenValidator { |
| 39 public: | 39 public: |
| 40 TokenValidatorBase( | 40 TokenValidatorBase( |
| 41 const ThirdPartyAuthConfig& third_party_auth_config, | 41 const ThirdPartyAuthConfig& third_party_auth_config, |
| 42 const std::string& token_scope, | 42 const std::string& token_scope, |
| 43 scoped_refptr<net::URLRequestContextGetter> request_context_getter); | 43 scoped_refptr<net::URLRequestContextGetter> request_context_getter); |
| 44 virtual ~TokenValidatorBase(); | 44 ~TokenValidatorBase() override; |
| 45 | 45 |
| 46 // TokenValidator interface. | 46 // TokenValidator interface. |
| 47 virtual void ValidateThirdPartyToken( | 47 void ValidateThirdPartyToken( |
| 48 const std::string& token, | 48 const std::string& token, |
| 49 const base::Callback<void( | 49 const base::Callback<void(const std::string& shared_secret)>& |
| 50 const std::string& shared_secret)>& on_token_validated) override; | 50 on_token_validated) override; |
| 51 | 51 |
| 52 virtual const GURL& token_url() const override; | 52 const GURL& token_url() const override; |
| 53 virtual const std::string& token_scope() const override; | 53 const std::string& token_scope() const override; |
| 54 | 54 |
| 55 // URLRequest::Delegate interface. | 55 // URLRequest::Delegate interface. |
| 56 virtual void OnResponseStarted(net::URLRequest* source) override; | 56 void OnResponseStarted(net::URLRequest* source) override; |
| 57 virtual void OnReadCompleted(net::URLRequest* source, | 57 void OnReadCompleted(net::URLRequest* source, int bytes_read) override; |
| 58 int bytes_read) override; | 58 void OnCertificateRequested( |
| 59 virtual void OnCertificateRequested( | |
| 60 net::URLRequest* source, | 59 net::URLRequest* source, |
| 61 net::SSLCertRequestInfo* cert_request_info) override; | 60 net::SSLCertRequestInfo* cert_request_info) override; |
| 62 | 61 |
| 63 protected: | 62 protected: |
| 64 void OnCertificatesSelected(net::CertificateList* selected_certs, | 63 void OnCertificatesSelected(net::CertificateList* selected_certs, |
| 65 net::ClientCertStore* unused); | 64 net::ClientCertStore* unused); |
| 66 | 65 |
| 67 virtual void StartValidateRequest(const std::string& token) = 0; | 66 virtual void StartValidateRequest(const std::string& token) = 0; |
| 68 virtual bool IsValidScope(const std::string& token_scope); | 67 virtual bool IsValidScope(const std::string& token_scope); |
| 69 std::string ProcessResponse(); | 68 std::string ProcessResponse(); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 81 base::Callback<void(const std::string& shared_secret)> on_token_validated_; | 80 base::Callback<void(const std::string& shared_secret)> on_token_validated_; |
| 82 | 81 |
| 83 base::WeakPtrFactory<TokenValidatorBase> weak_factory_; | 82 base::WeakPtrFactory<TokenValidatorBase> weak_factory_; |
| 84 | 83 |
| 85 DISALLOW_COPY_AND_ASSIGN(TokenValidatorBase); | 84 DISALLOW_COPY_AND_ASSIGN(TokenValidatorBase); |
| 86 }; | 85 }; |
| 87 | 86 |
| 88 } // namespace remoting | 87 } // namespace remoting |
| 89 | 88 |
| 90 #endif // REMOTING_HOST_TOKEN_VALIDATOR_BASE_H | 89 #endif // REMOTING_HOST_TOKEN_VALIDATOR_BASE_H |
| OLD | NEW |