Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(219)

Side by Side Diff: remoting/protocol/negotiating_client_authenticator.h

Issue 1778023002: Move NegotiatingClientAuthentication creation to ChromotingClient. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_NEGOTIATING_CLIENT_AUTHENTICATOR_H_ 5 #ifndef REMOTING_PROTOCOL_NEGOTIATING_CLIENT_AUTHENTICATOR_H_
6 #define REMOTING_PROTOCOL_NEGOTIATING_CLIENT_AUTHENTICATOR_H_ 6 #define REMOTING_PROTOCOL_NEGOTIATING_CLIENT_AUTHENTICATOR_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "base/memory/weak_ptr.h" 13 #include "base/memory/weak_ptr.h"
14 #include "remoting/protocol/authenticator.h" 14 #include "remoting/protocol/authenticator.h"
15 #include "remoting/protocol/negotiating_authenticator_base.h" 15 #include "remoting/protocol/negotiating_authenticator_base.h"
16 #include "remoting/protocol/third_party_client_authenticator.h" 16 #include "remoting/protocol/third_party_client_authenticator.h"
17 17
18 namespace remoting { 18 namespace remoting {
19 namespace protocol { 19 namespace protocol {
20 20
21 struct ClientAuthenticationConfig {
22 ClientAuthenticationConfig();
23 ~ClientAuthenticationConfig();
24
25 // Used for all authenticators.
26 std::string host_id;
27
28 // Used for pairing authenticators
29 std::string pairing_client_id;
30 std::string pairing_secret;
31
32 // Used for shared secret authenticators.
33 FetchSecretCallback fetch_secret_callback;
34
35 // Used for third party authenticators.
36 FetchThirdPartyTokenCallback fetch_third_party_token_callback;
37 };
38
21 // Client-side implementation of NegotiatingAuthenticatorBase. 39 // Client-side implementation of NegotiatingAuthenticatorBase.
22 // See comments in negotiating_authenticator_base.h for a general explanation. 40 // See comments in negotiating_authenticator_base.h for a general explanation.
23 class NegotiatingClientAuthenticator : public NegotiatingAuthenticatorBase { 41 class NegotiatingClientAuthenticator : public NegotiatingAuthenticatorBase {
24 public: 42 public:
25 // TODO(jamiewalch): Pass ClientConfig instead of separate parameters. 43 explicit NegotiatingClientAuthenticator(
26 NegotiatingClientAuthenticator( 44 const ClientAuthenticationConfig& config);
27 const std::string& client_pairing_id,
28 const std::string& shared_secret,
29 const std::string& authentication_tag,
30 const FetchSecretCallback& fetch_secret_callback,
31 const FetchThirdPartyTokenCallback& fetch_third_party_token_callback);
32
33 ~NegotiatingClientAuthenticator() override; 45 ~NegotiatingClientAuthenticator() override;
34 46
35 // Overriden from Authenticator. 47 // Overriden from Authenticator.
36 void ProcessMessage(const buzz::XmlElement* message, 48 void ProcessMessage(const buzz::XmlElement* message,
37 const base::Closure& resume_callback) override; 49 const base::Closure& resume_callback) override;
38 scoped_ptr<buzz::XmlElement> GetNextMessage() override; 50 scoped_ptr<buzz::XmlElement> GetNextMessage() override;
39 51
40 private: 52 private:
41 // (Asynchronously) creates an authenticator, and stores it in 53 // (Asynchronously) creates an authenticator, and stores it in
42 // |current_authenticator_|. Authenticators that can be started in either 54 // |current_authenticator_|. Authenticators that can be started in either
(...skipping 14 matching lines...) Expand all
57 // message. 69 // message.
58 void CreatePreferredAuthenticator(); 70 void CreatePreferredAuthenticator();
59 71
60 // Creates a V2Authenticator in state |initial_state| with the given 72 // Creates a V2Authenticator in state |initial_state| with the given
61 // |shared_secret|, then runs |resume_callback|. 73 // |shared_secret|, then runs |resume_callback|.
62 void CreateV2AuthenticatorWithSecret( 74 void CreateV2AuthenticatorWithSecret(
63 Authenticator::State initial_state, 75 Authenticator::State initial_state,
64 const base::Closure& resume_callback, 76 const base::Closure& resume_callback,
65 const std::string& shared_secret); 77 const std::string& shared_secret);
66 78
67 // Used for pairing authenticators 79 ClientAuthenticationConfig config_;
68 std::string client_pairing_id_;
69 std::string shared_secret_;
70
71 // Used for all authenticators.
72 std::string authentication_tag_;
73
74 // Used for shared secret authenticators.
75 FetchSecretCallback fetch_secret_callback_;
76
77 // Used for third party authenticators.
78 FetchThirdPartyTokenCallback fetch_third_party_token_callback_;
79 80
80 // Internal NegotiatingClientAuthenticator data. 81 // Internal NegotiatingClientAuthenticator data.
81 bool method_set_by_host_ = false; 82 bool method_set_by_host_ = false;
82 base::WeakPtrFactory<NegotiatingClientAuthenticator> weak_factory_; 83 base::WeakPtrFactory<NegotiatingClientAuthenticator> weak_factory_;
83 84
84 DISALLOW_COPY_AND_ASSIGN(NegotiatingClientAuthenticator); 85 DISALLOW_COPY_AND_ASSIGN(NegotiatingClientAuthenticator);
85 }; 86 };
86 87
87 } // namespace protocol 88 } // namespace protocol
88 } // namespace remoting 89 } // namespace remoting
89 90
90 #endif // REMOTING_PROTOCOL_NEGOTIATING_CLIENT_AUTHENTICATOR_H_ 91 #endif // REMOTING_PROTOCOL_NEGOTIATING_CLIENT_AUTHENTICATOR_H_
OLDNEW
« no previous file with comments | « remoting/protocol/negotiating_authenticator_unittest.cc ('k') | remoting/protocol/negotiating_client_authenticator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698