OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_PROTOCOL_THIRD_PARTY_HOST_AUTHENTICATOR_H_ | 5 #ifndef REMOTING_PROTOCOL_THIRD_PARTY_HOST_AUTHENTICATOR_H_ |
6 #define REMOTING_PROTOCOL_THIRD_PARTY_HOST_AUTHENTICATOR_H_ | 6 #define REMOTING_PROTOCOL_THIRD_PARTY_HOST_AUTHENTICATOR_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
| 11 #include "base/memory/ref_counted.h" |
11 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
12 #include "googleurl/src/gurl.h" | 13 #include "googleurl/src/gurl.h" |
13 #include "remoting/protocol/third_party_authenticator_base.h" | 14 #include "remoting/protocol/third_party_authenticator_base.h" |
14 | 15 |
15 namespace remoting { | 16 namespace remoting { |
16 | 17 |
17 class RsaKeyPair; | 18 class RsaKeyPair; |
18 | 19 |
19 namespace protocol { | 20 namespace protocol { |
20 | 21 |
(...skipping 26 matching lines...) Expand all Loading... |
47 const TokenValidatedCallback& token_validated_callback) = 0; | 48 const TokenValidatedCallback& token_validated_callback) = 0; |
48 | 49 |
49 // URL sent to the client, to be used by its |TokenFetcher| to get a token. | 50 // URL sent to the client, to be used by its |TokenFetcher| to get a token. |
50 virtual const GURL& token_url() const = 0; | 51 virtual const GURL& token_url() const = 0; |
51 | 52 |
52 // Space-separated list of connection attributes the host must send to the | 53 // Space-separated list of connection attributes the host must send to the |
53 // client, and require the token received in response to match. | 54 // client, and require the token received in response to match. |
54 virtual const std::string& token_scope() const = 0; | 55 virtual const std::string& token_scope() const = 0; |
55 }; | 56 }; |
56 | 57 |
| 58 class TokenValidatorFactory : public base::RefCounted<TokenValidatorFactory> { |
| 59 public: |
| 60 // Creates a TokenValidator. |local_jid| and |remote_jid| are used to create |
| 61 // a token scope that is restricted to the current connection's JIDs. |
| 62 virtual scoped_ptr<TokenValidator> CreateTokenValidator( |
| 63 const std::string& local_jid, |
| 64 const std::string& remote_jid) = 0; |
| 65 |
| 66 // Returns true if third party authentication is enabled for this host. |
| 67 virtual bool is_enabled() const = 0; |
| 68 |
| 69 protected: |
| 70 friend class base::RefCounted<TokenValidatorFactory>; |
| 71 virtual ~TokenValidatorFactory() {} |
| 72 }; |
| 73 |
57 // Creates a third-party host authenticator. |local_cert| and |key_pair| are | 74 // Creates a third-party host authenticator. |local_cert| and |key_pair| are |
58 // used by the underlying V2Authenticator to create the SSL channels. | 75 // used by the underlying V2Authenticator to create the SSL channels. |
59 // |token_validator| contains the token parameters to be sent to the client | 76 // |token_validator| contains the token parameters to be sent to the client |
60 // and is used to obtain the shared secret. | 77 // and is used to obtain the shared secret. |
61 ThirdPartyHostAuthenticator(const std::string& local_cert, | 78 ThirdPartyHostAuthenticator(const std::string& local_cert, |
62 scoped_refptr<RsaKeyPair> key_pair, | 79 scoped_refptr<RsaKeyPair> key_pair, |
63 scoped_ptr<TokenValidator> token_validator); | 80 scoped_ptr<TokenValidator> token_validator); |
64 virtual ~ThirdPartyHostAuthenticator(); | 81 virtual ~ThirdPartyHostAuthenticator(); |
65 | 82 |
66 protected: | 83 protected: |
(...skipping 10 matching lines...) Expand all Loading... |
77 | 94 |
78 std::string local_cert_; | 95 std::string local_cert_; |
79 scoped_refptr<RsaKeyPair> key_pair_; | 96 scoped_refptr<RsaKeyPair> key_pair_; |
80 scoped_ptr<TokenValidator> token_validator_; | 97 scoped_ptr<TokenValidator> token_validator_; |
81 }; | 98 }; |
82 | 99 |
83 } // namespace protocol | 100 } // namespace protocol |
84 } // namespace remoting | 101 } // namespace remoting |
85 | 102 |
86 #endif // REMOTING_PROTOCOL_THIRD_PARTY_HOST_AUTHENTICATOR_H_ | 103 #endif // REMOTING_PROTOCOL_THIRD_PARTY_HOST_AUTHENTICATOR_H_ |
OLD | NEW |