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" |
(...skipping 25 matching lines...) Expand all Loading... |
36 // TokenValidator interface. | 36 // TokenValidator interface. |
37 void ValidateThirdPartyToken( | 37 void ValidateThirdPartyToken( |
38 const std::string& token, | 38 const std::string& token, |
39 const base::Callback<void(const std::string& shared_secret)>& | 39 const base::Callback<void(const std::string& shared_secret)>& |
40 on_token_validated) override; | 40 on_token_validated) override; |
41 | 41 |
42 const GURL& token_url() const override; | 42 const GURL& token_url() const override; |
43 const std::string& token_scope() const override; | 43 const std::string& token_scope() const override; |
44 | 44 |
45 // URLRequest::Delegate interface. | 45 // URLRequest::Delegate interface. |
46 void OnResponseStarted(net::URLRequest* source) override; | 46 void OnResponseStarted(net::URLRequest* source, int net_error) override; |
47 void OnReadCompleted(net::URLRequest* source, int bytes_read) override; | 47 void OnReadCompleted(net::URLRequest* source, int bytes_read) 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::CertificateList* selected_certs, | 56 void OnCertificatesSelected(net::CertificateList* selected_certs, |
57 net::ClientCertStore* unused); | 57 net::ClientCertStore* unused); |
58 | 58 |
59 virtual void StartValidateRequest(const std::string& token) = 0; | 59 virtual void StartValidateRequest(const std::string& token) = 0; |
60 virtual bool IsValidScope(const std::string& token_scope); | 60 virtual bool IsValidScope(const std::string& token_scope); |
61 std::string ProcessResponse(); | 61 std::string ProcessResponse(int net_error); |
62 | 62 |
63 // Constructor parameters. | 63 // Constructor parameters. |
64 ThirdPartyAuthConfig third_party_auth_config_; | 64 ThirdPartyAuthConfig third_party_auth_config_; |
65 std::string token_scope_; | 65 std::string token_scope_; |
66 scoped_refptr<net::URLRequestContextGetter> request_context_getter_; | 66 scoped_refptr<net::URLRequestContextGetter> request_context_getter_; |
67 | 67 |
68 // URLRequest related fields. | 68 // URLRequest related fields. |
69 std::unique_ptr<net::URLRequest> request_; | 69 std::unique_ptr<net::URLRequest> request_; |
70 scoped_refptr<net::IOBuffer> buffer_; | 70 scoped_refptr<net::IOBuffer> buffer_; |
71 std::string data_; | 71 std::string data_; |
(...skipping 13 matching lines...) Expand all Loading... |
85 base::Callback<void(const std::string& shared_secret)> on_token_validated_; | 85 base::Callback<void(const std::string& shared_secret)> on_token_validated_; |
86 | 86 |
87 base::WeakPtrFactory<TokenValidatorBase> weak_factory_; | 87 base::WeakPtrFactory<TokenValidatorBase> weak_factory_; |
88 | 88 |
89 DISALLOW_COPY_AND_ASSIGN(TokenValidatorBase); | 89 DISALLOW_COPY_AND_ASSIGN(TokenValidatorBase); |
90 }; | 90 }; |
91 | 91 |
92 } // namespace remoting | 92 } // namespace remoting |
93 | 93 |
94 #endif // REMOTING_HOST_TOKEN_VALIDATOR_BASE_H | 94 #endif // REMOTING_HOST_TOKEN_VALIDATOR_BASE_H |
OLD | NEW |