| 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_forward.h" | 
| 11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" | 
| 12 | 12 | 
| 13 namespace buzz { | 13 namespace buzz { | 
| 14 class XmlElement; | 14 class XmlElement; | 
| 15 }  // namespace buzz | 15 }  // namespace buzz | 
| 16 | 16 | 
| 17 namespace remoting { | 17 namespace remoting { | 
| 18 namespace protocol { | 18 namespace protocol { | 
| 19 | 19 | 
| 20 class Authenticator; | 20 class Authenticator; | 
| 21 class ChannelAuthenticator; | 21 class ChannelAuthenticator; | 
| 22 | 22 | 
| 23 typedef base::Callback<void(const std::string& secret)> SecretFetchedCallback; |  | 
| 24 typedef base::Callback<void( |  | 
| 25     bool pairing_supported, |  | 
| 26     const SecretFetchedCallback& secret_fetched_callback)> FetchSecretCallback; |  | 
| 27 |  | 
| 28 // Callback passed to |FetchTokenCallback|, and called once the client |  | 
| 29 // authentication finishes. |token| is an opaque string that should be sent |  | 
| 30 // directly to the host. |shared_secret| should be used by the client to |  | 
| 31 // create a V2Authenticator. In case of failure, the callback is called with |  | 
| 32 // an empty |token| and |shared_secret|. |  | 
| 33 typedef base::Callback<void(const std::string& token, |  | 
| 34                             const std::string& shared_secret)> |  | 
| 35     ThirdPartyTokenFetchedCallback; |  | 
| 36 |  | 
| 37 // Fetches a third party token from |token_url|. |host_public_key| is sent to |  | 
| 38 // the server so it can later authenticate the host. |scope| is a string with a |  | 
| 39 // space-separated list of attributes for this connection (e.g. |  | 
| 40 // "hostjid:abc@example.com/123 clientjid:def@example.org/456". |  | 
| 41 // |token_fetched_callback| is called when the client authentication ends, on |  | 
| 42 // the same thread on which FetchThirdPartyTokenCallback was originally called. |  | 
| 43 typedef base::Callback<void( |  | 
| 44     const std::string& token_url, |  | 
| 45     const std::string& scope, |  | 
| 46     const ThirdPartyTokenFetchedCallback& token_fetched_callback)> |  | 
| 47     FetchThirdPartyTokenCallback; |  | 
| 48 |  | 
| 49 // Authenticator is an abstract interface for authentication protocol | 23 // Authenticator is an abstract interface for authentication protocol | 
| 50 // implementations. Different implementations of this interface may be used on | 24 // implementations. Different implementations of this interface may be used on | 
| 51 // each side of the connection depending of type of the auth protocol. Client | 25 // each side of the connection depending of type of the auth protocol. Client | 
| 52 // and host will repeatedly call their Authenticators and deliver the messages | 26 // and host will repeatedly call their Authenticators and deliver the messages | 
| 53 // they generate, until successful authentication is reported. | 27 // they generate, until successful authentication is reported. | 
| 54 // | 28 // | 
| 55 // Authenticator may exchange multiple messages before session is authenticated. | 29 // Authenticator may exchange multiple messages before session is authenticated. | 
| 56 // Each message sent/received by an Authenticator is delivered either in a | 30 // Each message sent/received by an Authenticator is delivered either in a | 
| 57 // session description inside session-initiate and session-accept messages or in | 31 // session description inside session-initiate and session-accept messages or in | 
| 58 // a session-info message. Session-info messages are used only if authenticators | 32 // a session-info message. Session-info messages are used only if authenticators | 
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 162   // for the result of this method. | 136   // for the result of this method. | 
| 163   virtual scoped_ptr<Authenticator> CreateAuthenticator( | 137   virtual scoped_ptr<Authenticator> CreateAuthenticator( | 
| 164       const std::string& local_jid, | 138       const std::string& local_jid, | 
| 165       const std::string& remote_jid) = 0; | 139       const std::string& remote_jid) = 0; | 
| 166 }; | 140 }; | 
| 167 | 141 | 
| 168 }  // namespace protocol | 142 }  // namespace protocol | 
| 169 }  // namespace remoting | 143 }  // namespace remoting | 
| 170 | 144 | 
| 171 #endif  // REMOTING_PROTOCOL_AUTHENTICATOR_H_ | 145 #endif  // REMOTING_PROTOCOL_AUTHENTICATOR_H_ | 
| OLD | NEW | 
|---|