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" |
11 #include "net/url_request/url_request_context_getter.h" | 11 #include "net/url_request/url_request_context_getter.h" |
| 12 #include "remoting/host/third_party_auth_config.h" |
12 #include "remoting/protocol/token_validator.h" | 13 #include "remoting/protocol/token_validator.h" |
13 #include "url/gurl.h" | 14 #include "url/gurl.h" |
14 | 15 |
15 namespace net { | 16 namespace net { |
16 class ClientCertStore; | 17 class ClientCertStore; |
17 typedef std::vector<scoped_refptr<X509Certificate> > CertificateList; | 18 typedef std::vector<scoped_refptr<X509Certificate> > CertificateList; |
18 } | 19 } |
19 | 20 |
20 namespace remoting { | 21 namespace remoting { |
21 | 22 |
22 struct ThirdPartyAuthConfig { | |
23 inline bool is_empty() const { | |
24 return token_url.is_empty() && token_validation_url.is_empty(); | |
25 } | |
26 | |
27 inline bool is_valid() const { | |
28 return token_url.is_valid() && token_validation_url.is_valid(); | |
29 } | |
30 | |
31 GURL token_url; | |
32 GURL token_validation_url; | |
33 std::string token_validation_cert_issuer; | |
34 }; | |
35 | |
36 class TokenValidatorBase | 23 class TokenValidatorBase |
37 : public net::URLRequest::Delegate, | 24 : public net::URLRequest::Delegate, |
38 public protocol::TokenValidator { | 25 public protocol::TokenValidator { |
39 public: | 26 public: |
40 TokenValidatorBase( | 27 TokenValidatorBase( |
41 const ThirdPartyAuthConfig& third_party_auth_config, | 28 const ThirdPartyAuthConfig& third_party_auth_config, |
42 const std::string& token_scope, | 29 const std::string& token_scope, |
43 scoped_refptr<net::URLRequestContextGetter> request_context_getter); | 30 scoped_refptr<net::URLRequestContextGetter> request_context_getter); |
44 ~TokenValidatorBase() override; | 31 ~TokenValidatorBase() override; |
45 | 32 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 base::Callback<void(const std::string& shared_secret)> on_token_validated_; | 67 base::Callback<void(const std::string& shared_secret)> on_token_validated_; |
81 | 68 |
82 base::WeakPtrFactory<TokenValidatorBase> weak_factory_; | 69 base::WeakPtrFactory<TokenValidatorBase> weak_factory_; |
83 | 70 |
84 DISALLOW_COPY_AND_ASSIGN(TokenValidatorBase); | 71 DISALLOW_COPY_AND_ASSIGN(TokenValidatorBase); |
85 }; | 72 }; |
86 | 73 |
87 } // namespace remoting | 74 } // namespace remoting |
88 | 75 |
89 #endif // REMOTING_HOST_TOKEN_VALIDATOR_BASE_H | 76 #endif // REMOTING_HOST_TOKEN_VALIDATOR_BASE_H |
OLD | NEW |