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" |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 const TokenValidatedCallback& token_validated_callback) = 0; | 47 const TokenValidatedCallback& token_validated_callback) = 0; |
48 | 48 |
49 // URL sent to the client, to be used by its |TokenFetcher| to get a token. | 49 // URL sent to the client, to be used by its |TokenFetcher| to get a token. |
50 virtual const GURL& token_url() const = 0; | 50 virtual const GURL& token_url() const = 0; |
51 | 51 |
52 // Space-separated list of connection attributes the host must send to the | 52 // Space-separated list of connection attributes the host must send to the |
53 // client, and require the token received in response to match. | 53 // client, and require the token received in response to match. |
54 virtual const std::string& token_scope() const = 0; | 54 virtual const std::string& token_scope() const = 0; |
55 }; | 55 }; |
56 | 56 |
| 57 class TokenValidatorFactory { |
| 58 public: |
| 59 virtual ~TokenValidatorFactory() {} |
| 60 |
| 61 // Creates a TokenValidator. |local_jid| and |remote_jid| are used to create |
| 62 // a token scope that is restricted to the current connection's JIDs. |
| 63 virtual scoped_ptr<TokenValidator> CreateTokenValidator( |
| 64 const std::string& local_jid, |
| 65 const std::string& remote_jid) = 0; |
| 66 }; |
| 67 |
57 // Creates a third-party host authenticator. |local_cert| and |key_pair| are | 68 // Creates a third-party host authenticator. |local_cert| and |key_pair| are |
58 // used by the underlying V2Authenticator to create the SSL channels. | 69 // used by the underlying V2Authenticator to create the SSL channels. |
59 // |token_validator| contains the token parameters to be sent to the client | 70 // |token_validator| contains the token parameters to be sent to the client |
60 // and is used to obtain the shared secret. | 71 // and is used to obtain the shared secret. |
61 ThirdPartyHostAuthenticator(const std::string& local_cert, | 72 ThirdPartyHostAuthenticator(const std::string& local_cert, |
62 scoped_refptr<RsaKeyPair> key_pair, | 73 scoped_refptr<RsaKeyPair> key_pair, |
63 scoped_ptr<TokenValidator> token_validator); | 74 scoped_ptr<TokenValidator> token_validator); |
64 virtual ~ThirdPartyHostAuthenticator(); | 75 virtual ~ThirdPartyHostAuthenticator(); |
65 | 76 |
66 protected: | 77 protected: |
67 // ThirdPartyAuthenticator implementation. | 78 // ThirdPartyAuthenticator implementation. |
68 virtual void ProcessTokenMessage( | 79 virtual void ProcessTokenMessage( |
69 const buzz::XmlElement* message, | 80 const buzz::XmlElement* message, |
70 const base::Closure& resume_callback) OVERRIDE; | 81 const base::Closure& resume_callback) OVERRIDE; |
71 virtual void AddTokenElements(buzz::XmlElement* message) OVERRIDE; | 82 virtual void AddTokenElements(buzz::XmlElement* message) OVERRIDE; |
72 | 83 |
73 private: | 84 private: |
74 void OnThirdPartyTokenValidated(const buzz::XmlElement* message, | 85 void OnThirdPartyTokenValidated(const buzz::XmlElement* message, |
75 const base::Closure& resume_callback, | 86 const base::Closure& resume_callback, |
76 const std::string& shared_secret); | 87 const std::string& shared_secret); |
77 | 88 |
78 std::string local_cert_; | 89 std::string local_cert_; |
79 scoped_refptr<RsaKeyPair> key_pair_; | 90 scoped_refptr<RsaKeyPair> key_pair_; |
80 scoped_ptr<TokenValidator> token_validator_; | 91 scoped_ptr<TokenValidator> token_validator_; |
| 92 |
| 93 DISALLOW_COPY_AND_ASSIGN(ThirdPartyHostAuthenticator); |
81 }; | 94 }; |
82 | 95 |
83 } // namespace protocol | 96 } // namespace protocol |
84 } // namespace remoting | 97 } // namespace remoting |
85 | 98 |
86 #endif // REMOTING_PROTOCOL_THIRD_PARTY_HOST_AUTHENTICATOR_H_ | 99 #endif // REMOTING_PROTOCOL_THIRD_PARTY_HOST_AUTHENTICATOR_H_ |
OLD | NEW |