OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef REMOTING_PROTOCOL_CLIENT_AUTHENTICATION_CONFIG_H_ |
| 6 #define REMOTING_PROTOCOL_CLIENT_AUTHENTICATION_CONFIG_H_ |
| 7 |
| 8 #include <string> |
| 9 |
| 10 #include "base/callback.h" |
| 11 |
| 12 namespace remoting { |
| 13 namespace protocol { |
| 14 |
| 15 typedef base::Callback<void(const std::string& secret)> SecretFetchedCallback; |
| 16 typedef base::Callback<void( |
| 17 bool pairing_supported, |
| 18 const SecretFetchedCallback& secret_fetched_callback)> FetchSecretCallback; |
| 19 |
| 20 // Callback passed to |FetchTokenCallback|, and called once the client |
| 21 // authentication finishes. |token| is an opaque string that should be sent |
| 22 // directly to the host. |shared_secret| should be used by the client to |
| 23 // create a V2Authenticator. In case of failure, the callback is called with |
| 24 // an empty |token| and |shared_secret|. |
| 25 typedef base::Callback<void(const std::string& token, |
| 26 const std::string& shared_secret)> |
| 27 ThirdPartyTokenFetchedCallback; |
| 28 |
| 29 // Fetches a third party token from |token_url|. |host_public_key| is sent to |
| 30 // the server so it can later authenticate the host. |scope| is a string with a |
| 31 // space-separated list of attributes for this connection (e.g. |
| 32 // "hostjid:abc@example.com/123 clientjid:def@example.org/456". |
| 33 // |token_fetched_callback| is called when the client authentication ends, on |
| 34 // the same thread on which FetchThirdPartyTokenCallback was originally called. |
| 35 typedef base::Callback<void( |
| 36 const std::string& token_url, |
| 37 const std::string& scope, |
| 38 const ThirdPartyTokenFetchedCallback& token_fetched_callback)> |
| 39 FetchThirdPartyTokenCallback; |
| 40 |
| 41 struct ClientAuthenticationConfig { |
| 42 ClientAuthenticationConfig(); |
| 43 ~ClientAuthenticationConfig(); |
| 44 |
| 45 // Used for all authenticators. |
| 46 std::string host_id; |
| 47 |
| 48 // Used for pairing authenticators |
| 49 std::string pairing_client_id; |
| 50 std::string pairing_secret; |
| 51 |
| 52 // Used for shared secret authenticators. |
| 53 FetchSecretCallback fetch_secret_callback; |
| 54 |
| 55 // Used for third party authenticators. |
| 56 FetchThirdPartyTokenCallback fetch_third_party_token_callback; |
| 57 }; |
| 58 |
| 59 } // namespace protocol |
| 60 } // namespace remoting |
| 61 |
| 62 #endif // REMOTING_PROTOCOL_CLIENT_AUTHENTICATION_CONFIG_H_ |
OLD | NEW |