OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_NEGOTIATING_AUTHENTICATOR_H_ | 5 #ifndef REMOTING_PROTOCOL_NEGOTIATING_AUTHENTICATOR_H_ |
6 #define REMOTING_PROTOCOL_NEGOTIATING_AUTHENTICATOR_H_ | 6 #define REMOTING_PROTOCOL_NEGOTIATING_AUTHENTICATOR_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 22 matching lines...) Expand all Loading... |
33 | 33 |
34 static scoped_ptr<Authenticator> CreateForHost( | 34 static scoped_ptr<Authenticator> CreateForHost( |
35 const std::string& local_cert, | 35 const std::string& local_cert, |
36 const crypto::RSAPrivateKey& local_private_key, | 36 const crypto::RSAPrivateKey& local_private_key, |
37 const std::string& shared_secret_hash, | 37 const std::string& shared_secret_hash, |
38 AuthenticationMethod::HashFunction hash_function); | 38 AuthenticationMethod::HashFunction hash_function); |
39 | 39 |
40 // Authenticator interface. | 40 // Authenticator interface. |
41 virtual State state() const OVERRIDE; | 41 virtual State state() const OVERRIDE; |
42 virtual RejectionReason rejection_reason() const OVERRIDE; | 42 virtual RejectionReason rejection_reason() const OVERRIDE; |
43 virtual void ProcessMessage(const buzz::XmlElement* message) OVERRIDE; | 43 virtual void ProcessMessage(const buzz::XmlElement* message, |
| 44 const base::Closure& resume_callback) OVERRIDE; |
44 virtual scoped_ptr<buzz::XmlElement> GetNextMessage() OVERRIDE; | 45 virtual scoped_ptr<buzz::XmlElement> GetNextMessage() OVERRIDE; |
45 virtual scoped_ptr<ChannelAuthenticator> | 46 virtual scoped_ptr<ChannelAuthenticator> |
46 CreateChannelAuthenticator() const OVERRIDE; | 47 CreateChannelAuthenticator() const OVERRIDE; |
47 | 48 |
48 private: | 49 private: |
49 NegotiatingAuthenticator(Authenticator::State initial_state); | 50 NegotiatingAuthenticator(Authenticator::State initial_state); |
50 | 51 |
51 void AddMethod(const AuthenticationMethod& method); | 52 void AddMethod(const AuthenticationMethod& method); |
52 void CreateAuthenticator(State initial_state); | 53 void CreateAuthenticator(State initial_state); |
| 54 void UpdateState(const base::Closure& resume_callback); |
| 55 |
53 bool is_host_side() const; | 56 bool is_host_side() const; |
54 | 57 |
55 // Used only for host authenticators. | 58 // Used only for host authenticators. |
56 std::string local_cert_; | 59 std::string local_cert_; |
57 scoped_ptr<crypto::RSAPrivateKey> local_private_key_; | 60 scoped_ptr<crypto::RSAPrivateKey> local_private_key_; |
58 bool certificate_sent_; | 61 bool certificate_sent_; |
59 std::string shared_secret_hash_; | 62 std::string shared_secret_hash_; |
60 | 63 |
61 // Used only for client authenticators. | 64 // Used only for client authenticators. |
62 std::string remote_cert_; | 65 std::string remote_cert_; |
63 std::string authentication_tag_; | 66 std::string authentication_tag_; |
64 std::string shared_secret_; | 67 std::string shared_secret_; |
65 | 68 |
66 // Used for both host and client authenticators. | 69 // Used for both host and client authenticators. |
67 std::vector<AuthenticationMethod> methods_; | 70 std::vector<AuthenticationMethod> methods_; |
68 AuthenticationMethod current_method_; | 71 AuthenticationMethod current_method_; |
69 scoped_ptr<Authenticator> current_authenticator_; | 72 scoped_ptr<Authenticator> current_authenticator_; |
70 State state_; | 73 State state_; |
71 RejectionReason rejection_reason_; | 74 RejectionReason rejection_reason_; |
72 | 75 |
73 DISALLOW_COPY_AND_ASSIGN(NegotiatingAuthenticator); | 76 DISALLOW_COPY_AND_ASSIGN(NegotiatingAuthenticator); |
74 }; | 77 }; |
75 | 78 |
76 } // namespace protocol | 79 } // namespace protocol |
77 } // namespace remoting | 80 } // namespace remoting |
78 | 81 |
79 #endif // REMOTING_PROTOCOL_NEGOTIATING_AUTHENTICATOR_H_ | 82 #endif // REMOTING_PROTOCOL_NEGOTIATING_AUTHENTICATOR_H_ |
OLD | NEW |