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 24 matching lines...) Expand all Loading... |
35 // Creates a host authenticator, using a fixed shared secret/PIN hash. | 35 // Creates a host authenticator, using a fixed shared secret/PIN hash. |
36 static scoped_ptr<Authenticator> CreateForHost( | 36 static scoped_ptr<Authenticator> CreateForHost( |
37 const std::string& local_cert, | 37 const std::string& local_cert, |
38 scoped_refptr<RsaKeyPair> key_pair, | 38 scoped_refptr<RsaKeyPair> key_pair, |
39 const std::string& shared_secret_hash, | 39 const std::string& shared_secret_hash, |
40 AuthenticationMethod::HashFunction hash_function); | 40 AuthenticationMethod::HashFunction hash_function); |
41 | 41 |
42 // Authenticator interface. | 42 // Authenticator interface. |
43 virtual State state() const OVERRIDE; | 43 virtual State state() const OVERRIDE; |
44 virtual RejectionReason rejection_reason() const OVERRIDE; | 44 virtual RejectionReason rejection_reason() const OVERRIDE; |
45 virtual void ProcessMessage(const buzz::XmlElement* message) OVERRIDE; | 45 virtual void ProcessMessage(const buzz::XmlElement* message, |
| 46 const base::Closure& resume_callback) OVERRIDE; |
46 virtual scoped_ptr<buzz::XmlElement> GetNextMessage() OVERRIDE; | 47 virtual scoped_ptr<buzz::XmlElement> GetNextMessage() OVERRIDE; |
47 virtual scoped_ptr<ChannelAuthenticator> | 48 virtual scoped_ptr<ChannelAuthenticator> |
48 CreateChannelAuthenticator() const OVERRIDE; | 49 CreateChannelAuthenticator() const OVERRIDE; |
49 | 50 |
50 private: | 51 private: |
51 NegotiatingAuthenticator(Authenticator::State initial_state); | 52 NegotiatingAuthenticator(Authenticator::State initial_state); |
52 | 53 |
53 void AddMethod(const AuthenticationMethod& method); | 54 void AddMethod(const AuthenticationMethod& method); |
54 void CreateAuthenticator(State initial_state); | 55 void CreateAuthenticator(State initial_state); |
| 56 void UpdateState(const base::Closure& resume_callback); |
55 | 57 |
56 bool is_host_side() const; | 58 bool is_host_side() const; |
57 | 59 |
58 // Used only for host authenticators. | 60 // Used only for host authenticators. |
59 std::string local_cert_; | 61 std::string local_cert_; |
60 scoped_refptr<RsaKeyPair> key_pair_; | 62 scoped_refptr<RsaKeyPair> key_pair_; |
61 std::string shared_secret_hash_; | 63 std::string shared_secret_hash_; |
62 | 64 |
63 // Used only for client authenticators. | 65 // Used only for client authenticators. |
64 std::string authentication_tag_; | 66 std::string authentication_tag_; |
65 std::string shared_secret_; | 67 std::string shared_secret_; |
66 | 68 |
67 // Used for both host and client authenticators. | 69 // Used for both host and client authenticators. |
68 std::vector<AuthenticationMethod> methods_; | 70 std::vector<AuthenticationMethod> methods_; |
69 AuthenticationMethod current_method_; | 71 AuthenticationMethod current_method_; |
70 scoped_ptr<Authenticator> current_authenticator_; | 72 scoped_ptr<Authenticator> current_authenticator_; |
71 State state_; | 73 State state_; |
72 RejectionReason rejection_reason_; | 74 RejectionReason rejection_reason_; |
73 | 75 |
74 DISALLOW_COPY_AND_ASSIGN(NegotiatingAuthenticator); | 76 DISALLOW_COPY_AND_ASSIGN(NegotiatingAuthenticator); |
75 }; | 77 }; |
76 | 78 |
77 } // namespace protocol | 79 } // namespace protocol |
78 } // namespace remoting | 80 } // namespace remoting |
79 | 81 |
80 #endif // REMOTING_PROTOCOL_NEGOTIATING_AUTHENTICATOR_H_ | 82 #endif // REMOTING_PROTOCOL_NEGOTIATING_AUTHENTICATOR_H_ |
OLD | NEW |