| 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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 | 107 |
| 108 // Must be called when in MESSAGE_READY state. Returns next | 108 // Must be called when in MESSAGE_READY state. Returns next |
| 109 // authentication message that needs to be sent to the peer. | 109 // authentication message that needs to be sent to the peer. |
| 110 virtual scoped_ptr<buzz::XmlElement> GetNextMessage() = 0; | 110 virtual scoped_ptr<buzz::XmlElement> GetNextMessage() = 0; |
| 111 | 111 |
| 112 // Returns the auth key received as result of the authentication handshake. | 112 // Returns the auth key received as result of the authentication handshake. |
| 113 virtual const std::string& GetAuthKey() const = 0; | 113 virtual const std::string& GetAuthKey() const = 0; |
| 114 | 114 |
| 115 // Creates new authenticator for a channel. Can be called only in | 115 // Creates new authenticator for a channel. Can be called only in |
| 116 // the ACCEPTED state. | 116 // the ACCEPTED state. |
| 117 // | |
| 118 // TODO(sergeyu): Remove this method once migration to QUIC is finished. | |
| 119 virtual scoped_ptr<ChannelAuthenticator> | 117 virtual scoped_ptr<ChannelAuthenticator> |
| 120 CreateChannelAuthenticator() const = 0; | 118 CreateChannelAuthenticator() const = 0; |
| 121 }; | 119 }; |
| 122 | 120 |
| 123 // Factory for Authenticator instances. | 121 // Factory for Authenticator instances. |
| 124 class AuthenticatorFactory { | 122 class AuthenticatorFactory { |
| 125 public: | 123 public: |
| 126 AuthenticatorFactory() {} | 124 AuthenticatorFactory() {} |
| 127 virtual ~AuthenticatorFactory() {} | 125 virtual ~AuthenticatorFactory() {} |
| 128 | 126 |
| 129 // Called when session-initiate stanza is received to create | 127 // Called when session-initiate stanza is received to create |
| 130 // authenticator for the new session. |first_message| specifies | 128 // authenticator for the new session. |first_message| specifies |
| 131 // authentication part of the session-initiate stanza so that | 129 // authentication part of the session-initiate stanza so that |
| 132 // appropriate type of Authenticator can be chosen for the session | 130 // appropriate type of Authenticator can be chosen for the session |
| 133 // (useful when multiple authenticators is supported). Returns nullptr | 131 // (useful when multiple authenticators is supported). Returns nullptr |
| 134 // if the |first_message| is invalid and the session should be | 132 // if the |first_message| is invalid and the session should be |
| 135 // rejected. ProcessMessage() should be called with |first_message| | 133 // rejected. ProcessMessage() should be called with |first_message| |
| 136 // for the result of this method. | 134 // for the result of this method. |
| 137 virtual scoped_ptr<Authenticator> CreateAuthenticator( | 135 virtual scoped_ptr<Authenticator> CreateAuthenticator( |
| 138 const std::string& local_jid, | 136 const std::string& local_jid, |
| 139 const std::string& remote_jid, | 137 const std::string& remote_jid, |
| 140 const buzz::XmlElement* first_message) = 0; | 138 const buzz::XmlElement* first_message) = 0; |
| 141 }; | 139 }; |
| 142 | 140 |
| 143 } // namespace protocol | 141 } // namespace protocol |
| 144 } // namespace remoting | 142 } // namespace remoting |
| 145 | 143 |
| 146 #endif // REMOTING_PROTOCOL_AUTHENTICATOR_H_ | 144 #endif // REMOTING_PROTOCOL_AUTHENTICATOR_H_ |
| OLD | NEW |