| 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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 PROTOCOL_ERROR, | 72 PROTOCOL_ERROR, |
| 73 }; | 73 }; |
| 74 | 74 |
| 75 // Returns true if |message| is an Authenticator message. | 75 // Returns true if |message| is an Authenticator message. |
| 76 static bool IsAuthenticatorMessage(const buzz::XmlElement* message); | 76 static bool IsAuthenticatorMessage(const buzz::XmlElement* message); |
| 77 | 77 |
| 78 // Creates an empty Authenticator message, owned by the caller. | 78 // Creates an empty Authenticator message, owned by the caller. |
| 79 static scoped_ptr<buzz::XmlElement> CreateEmptyAuthenticatorMessage(); | 79 static scoped_ptr<buzz::XmlElement> CreateEmptyAuthenticatorMessage(); |
| 80 | 80 |
| 81 // Finds Authenticator message among child elements of |message|, or | 81 // Finds Authenticator message among child elements of |message|, or |
| 82 // returns NULL otherwise. | 82 // returns nullptr 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 | 92 // Returns whether authentication has started. The chromoting host uses this |
| (...skipping 25 matching lines...) Expand all Loading... |
| 118 // Factory for Authenticator instances. | 118 // Factory for Authenticator instances. |
| 119 class AuthenticatorFactory { | 119 class AuthenticatorFactory { |
| 120 public: | 120 public: |
| 121 AuthenticatorFactory() {} | 121 AuthenticatorFactory() {} |
| 122 virtual ~AuthenticatorFactory() {} | 122 virtual ~AuthenticatorFactory() {} |
| 123 | 123 |
| 124 // Called when session-initiate stanza is received to create | 124 // Called when session-initiate stanza is received to create |
| 125 // authenticator for the new session. |first_message| specifies | 125 // authenticator for the new session. |first_message| specifies |
| 126 // authentication part of the session-initiate stanza so that | 126 // authentication part of the session-initiate stanza so that |
| 127 // appropriate type of Authenticator can be chosen for the session | 127 // appropriate type of Authenticator can be chosen for the session |
| 128 // (useful when multiple authenticators is supported). Returns NULL | 128 // (useful when multiple authenticators is supported). Returns nullptr |
| 129 // if the |first_message| is invalid and the session should be | 129 // if the |first_message| is invalid and the session should be |
| 130 // rejected. ProcessMessage() should be called with |first_message| | 130 // rejected. ProcessMessage() should be called with |first_message| |
| 131 // for the result of this method. | 131 // for the result of this method. |
| 132 virtual scoped_ptr<Authenticator> CreateAuthenticator( | 132 virtual scoped_ptr<Authenticator> CreateAuthenticator( |
| 133 const std::string& local_jid, | 133 const std::string& local_jid, |
| 134 const std::string& remote_jid, | 134 const std::string& remote_jid, |
| 135 const buzz::XmlElement* first_message) = 0; | 135 const buzz::XmlElement* first_message) = 0; |
| 136 }; | 136 }; |
| 137 | 137 |
| 138 } // namespace protocol | 138 } // namespace protocol |
| 139 } // namespace remoting | 139 } // namespace remoting |
| 140 | 140 |
| 141 #endif // REMOTING_PROTOCOL_AUTHENTICATOR_H_ | 141 #endif // REMOTING_PROTOCOL_AUTHENTICATOR_H_ |
| OLD | NEW |