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