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> |
| 9 |
8 #include "base/callback.h" | 10 #include "base/callback.h" |
9 #include "base/macros.h" | 11 #include "base/macros.h" |
10 #include "base/memory/scoped_ptr.h" | |
11 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
12 #include "net/url_request/url_request.h" | 13 #include "net/url_request/url_request.h" |
13 #include "net/url_request/url_request_context_getter.h" | 14 #include "net/url_request/url_request_context_getter.h" |
14 #include "remoting/host/third_party_auth_config.h" | 15 #include "remoting/host/third_party_auth_config.h" |
15 #include "remoting/protocol/token_validator.h" | 16 #include "remoting/protocol/token_validator.h" |
16 #include "url/gurl.h" | 17 #include "url/gurl.h" |
17 | 18 |
18 namespace net { | 19 namespace net { |
19 class ClientCertStore; | 20 class ClientCertStore; |
20 typedef std::vector<scoped_refptr<X509Certificate> > CertificateList; | 21 typedef std::vector<scoped_refptr<X509Certificate> > CertificateList; |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 virtual void StartValidateRequest(const std::string& token) = 0; | 59 virtual void StartValidateRequest(const std::string& token) = 0; |
59 virtual bool IsValidScope(const std::string& token_scope); | 60 virtual bool IsValidScope(const std::string& token_scope); |
60 std::string ProcessResponse(); | 61 std::string ProcessResponse(); |
61 | 62 |
62 // Constructor parameters. | 63 // Constructor parameters. |
63 ThirdPartyAuthConfig third_party_auth_config_; | 64 ThirdPartyAuthConfig third_party_auth_config_; |
64 std::string token_scope_; | 65 std::string token_scope_; |
65 scoped_refptr<net::URLRequestContextGetter> request_context_getter_; | 66 scoped_refptr<net::URLRequestContextGetter> request_context_getter_; |
66 | 67 |
67 // URLRequest related fields. | 68 // URLRequest related fields. |
68 scoped_ptr<net::URLRequest> request_; | 69 std::unique_ptr<net::URLRequest> request_; |
69 scoped_refptr<net::IOBuffer> buffer_; | 70 scoped_refptr<net::IOBuffer> buffer_; |
70 std::string data_; | 71 std::string data_; |
71 | 72 |
72 // This is set by OnReceivedRedirect() if the token validation request is | 73 // This is set by OnReceivedRedirect() if the token validation request is |
73 // being re-submitted as a POST request. This can happen if the authentication | 74 // being re-submitted as a POST request. This can happen if the authentication |
74 // cookie has not yet been set, and a login handler redirection causes the | 75 // cookie has not yet been set, and a login handler redirection causes the |
75 // POST request to be turned into a GET operation, losing the POST data. In | 76 // POST request to be turned into a GET operation, losing the POST data. In |
76 // this case, an immediate retry (with the same cookie jar) is expected to | 77 // this case, an immediate retry (with the same cookie jar) is expected to |
77 // succeeed. | 78 // succeeed. |
78 bool retrying_request_ = false; | 79 bool retrying_request_ = false; |
79 | 80 |
80 // Stores the most recently requested token, in case the validation request | 81 // Stores the most recently requested token, in case the validation request |
81 // needs to be retried. | 82 // needs to be retried. |
82 std::string token_; | 83 std::string token_; |
83 | 84 |
84 base::Callback<void(const std::string& shared_secret)> on_token_validated_; | 85 base::Callback<void(const std::string& shared_secret)> on_token_validated_; |
85 | 86 |
86 base::WeakPtrFactory<TokenValidatorBase> weak_factory_; | 87 base::WeakPtrFactory<TokenValidatorBase> weak_factory_; |
87 | 88 |
88 DISALLOW_COPY_AND_ASSIGN(TokenValidatorBase); | 89 DISALLOW_COPY_AND_ASSIGN(TokenValidatorBase); |
89 }; | 90 }; |
90 | 91 |
91 } // namespace remoting | 92 } // namespace remoting |
92 | 93 |
93 #endif // REMOTING_HOST_TOKEN_VALIDATOR_BASE_H | 94 #endif // REMOTING_HOST_TOKEN_VALIDATOR_BASE_H |
OLD | NEW |