OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_VALIDATING_AUTHENTICATOR_H_ | 5 #ifndef REMOTING_PROTOCOL_VALIDATING_AUTHENTICATOR_H_ |
6 #define REMOTING_PROTOCOL_VALIDATING_AUTHENTICATOR_H_ | 6 #define REMOTING_PROTOCOL_VALIDATING_AUTHENTICATOR_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 11 matching lines...) Expand all Loading... |
22 // logic supplied by the caller is run when the first message is received from | 22 // logic supplied by the caller is run when the first message is received from |
23 // the client. If the connection details are valid (e.g. conform to the current | 23 // the client. If the connection details are valid (e.g. conform to the current |
24 // policies), then the initial message, and all subsequent messages, are passed | 24 // policies), then the initial message, and all subsequent messages, are passed |
25 // to the underlying authenticator instance for processing. | 25 // to the underlying authenticator instance for processing. |
26 class ValidatingAuthenticator : public Authenticator { | 26 class ValidatingAuthenticator : public Authenticator { |
27 public: | 27 public: |
28 enum class Result { | 28 enum class Result { |
29 SUCCESS, | 29 SUCCESS, |
30 ERROR_INVALID_CREDENTIALS, | 30 ERROR_INVALID_CREDENTIALS, |
31 ERROR_INVALID_ACCOUNT, | 31 ERROR_INVALID_ACCOUNT, |
32 ERROR_REJECTED_BY_USER | 32 ERROR_REJECTED_BY_USER, |
| 33 ERROR_TOO_MANY_CONNECTIONS |
33 }; | 34 }; |
34 | 35 |
35 typedef base::Callback<void(Result validation_result)> ResultCallback; | 36 typedef base::Callback<void(Result validation_result)> ResultCallback; |
36 | 37 |
37 typedef base::Callback<void(const std::string& remote_jid, | 38 typedef base::Callback<void(const std::string& remote_jid, |
38 const ResultCallback& callback)> | 39 const ResultCallback& callback)> |
39 ValidationCallback; | 40 ValidationCallback; |
40 | 41 |
41 ValidatingAuthenticator(const std::string& remote_jid, | 42 ValidatingAuthenticator(const std::string& remote_jid, |
42 const ValidationCallback& validation_callback, | 43 const ValidationCallback& validation_callback, |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 | 84 |
84 base::WeakPtrFactory<ValidatingAuthenticator> weak_factory_; | 85 base::WeakPtrFactory<ValidatingAuthenticator> weak_factory_; |
85 | 86 |
86 DISALLOW_COPY_AND_ASSIGN(ValidatingAuthenticator); | 87 DISALLOW_COPY_AND_ASSIGN(ValidatingAuthenticator); |
87 }; | 88 }; |
88 | 89 |
89 } // namespace protocol | 90 } // namespace protocol |
90 } // namespace remoting | 91 } // namespace remoting |
91 | 92 |
92 #endif // REMOTING_PROTOCOL_VALIDATING_AUTHENTICATOR_H_ | 93 #endif // REMOTING_PROTOCOL_VALIDATING_AUTHENTICATOR_H_ |
OLD | NEW |