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_AUTHENTICATOR_H_ | 5 #ifndef REMOTING_PROTOCOL_AUTHENTICATOR_H_ |
6 #define REMOTING_PROTOCOL_AUTHENTICATOR_H_ | 6 #define REMOTING_PROTOCOL_AUTHENTICATOR_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 // returns NULL otherwise. | 82 // returns NULL otherwise. |
83 static const buzz::XmlElement* FindAuthenticatorMessage( | 83 static const buzz::XmlElement* FindAuthenticatorMessage( |
84 const buzz::XmlElement* message); | 84 const buzz::XmlElement* message); |
85 | 85 |
86 Authenticator() {} | 86 Authenticator() {} |
87 virtual ~Authenticator() {} | 87 virtual ~Authenticator() {} |
88 | 88 |
89 // Returns current state of the authenticator. | 89 // Returns current state of the authenticator. |
90 virtual State state() const = 0; | 90 virtual State state() const = 0; |
91 | 91 |
| 92 // Returns whether authentication has started. The chromoting host uses this |
| 93 // method to starts the back off process to prevent malicious clients from |
| 94 // guessing the PIN by spamming the host with auth requests. |
| 95 virtual bool started() const = 0; |
| 96 |
92 // Returns rejection reason. Can be called only when in REJECTED state. | 97 // Returns rejection reason. Can be called only when in REJECTED state. |
93 virtual RejectionReason rejection_reason() const = 0; | 98 virtual RejectionReason rejection_reason() const = 0; |
94 | 99 |
95 // Called in response to incoming message received from the peer. | 100 // Called in response to incoming message received from the peer. |
96 // Should only be called when in WAITING_MESSAGE state. Caller retains | 101 // Should only be called when in WAITING_MESSAGE state. Caller retains |
97 // ownership of |message|. |resume_callback| will be called when processing is | 102 // ownership of |message|. |resume_callback| will be called when processing is |
98 // finished. The implementation must guarantee that |resume_callback| is not | 103 // finished. The implementation must guarantee that |resume_callback| is not |
99 // called after the Authenticator is destroyed. | 104 // called after the Authenticator is destroyed. |
100 virtual void ProcessMessage(const buzz::XmlElement* message, | 105 virtual void ProcessMessage(const buzz::XmlElement* message, |
101 const base::Closure& resume_callback) = 0; | 106 const base::Closure& resume_callback) = 0; |
(...skipping 25 matching lines...) Expand all Loading... |
127 virtual scoped_ptr<Authenticator> CreateAuthenticator( | 132 virtual scoped_ptr<Authenticator> CreateAuthenticator( |
128 const std::string& local_jid, | 133 const std::string& local_jid, |
129 const std::string& remote_jid, | 134 const std::string& remote_jid, |
130 const buzz::XmlElement* first_message) = 0; | 135 const buzz::XmlElement* first_message) = 0; |
131 }; | 136 }; |
132 | 137 |
133 } // namespace protocol | 138 } // namespace protocol |
134 } // namespace remoting | 139 } // namespace remoting |
135 | 140 |
136 #endif // REMOTING_PROTOCOL_AUTHENTICATOR_H_ | 141 #endif // REMOTING_PROTOCOL_AUTHENTICATOR_H_ |
OLD | NEW |