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

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

Issue 12475020: Client plugin changes to support third party authentication. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: extraneous override Created 7 years, 8 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/basictypes.h" 11 #include "base/basictypes.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/authentication_method.h" 14 #include "remoting/protocol/authentication_method.h"
15 #include "remoting/protocol/authenticator.h" 15 #include "remoting/protocol/authenticator.h"
16 #include "remoting/protocol/negotiating_authenticator_base.h" 16 #include "remoting/protocol/negotiating_authenticator_base.h"
17 #include "remoting/protocol/third_party_client_authenticator.h"
17 18
18 namespace remoting { 19 namespace remoting {
19 namespace protocol { 20 namespace protocol {
20 21
21 typedef base::Callback<void(const std::string& secret)> SecretFetchedCallback; 22 typedef base::Callback<void(const std::string& secret)> SecretFetchedCallback;
22 typedef base::Callback<void( 23 typedef base::Callback<void(
23 const SecretFetchedCallback& secret_fetched_callback)> FetchSecretCallback; 24 const SecretFetchedCallback& secret_fetched_callback)> FetchSecretCallback;
24 25
25 // Client-side implementation of NegotiatingAuthenticatorBase. 26 // Client-side implementation of NegotiatingAuthenticatorBase.
26 // See comments in negotiating_authenticator_base.h for a general explanation. 27 // See comments in negotiating_authenticator_base.h for a general explanation.
27 class NegotiatingClientAuthenticator : public NegotiatingAuthenticatorBase { 28 class NegotiatingClientAuthenticator : public NegotiatingAuthenticatorBase {
28 public: 29 public:
29 NegotiatingClientAuthenticator( 30 NegotiatingClientAuthenticator(
30 const std::string& authentication_tag, 31 const std::string& authentication_tag,
31 const FetchSecretCallback& fetch_secret_callback, 32 const FetchSecretCallback& fetch_secret_callback,
33 scoped_ptr<ThirdPartyClientAuthenticator::TokenFetcher> token_fetcher_,
32 const std::vector<AuthenticationMethod>& methods); 34 const std::vector<AuthenticationMethod>& methods);
33 35
34 virtual ~NegotiatingClientAuthenticator(); 36 virtual ~NegotiatingClientAuthenticator();
35 37
36 // Overriden from Authenticator. 38 // Overriden from Authenticator.
37 virtual void ProcessMessage(const buzz::XmlElement* message, 39 virtual void ProcessMessage(const buzz::XmlElement* message,
38 const base::Closure& resume_callback) OVERRIDE; 40 const base::Closure& resume_callback) OVERRIDE;
39 virtual scoped_ptr<buzz::XmlElement> GetNextMessage() OVERRIDE; 41 virtual scoped_ptr<buzz::XmlElement> GetNextMessage() OVERRIDE;
40 42
41 private: 43 private:
42 // (Asynchronously) creates an authenticator, and stores it in 44 // (Asynchronously) creates an authenticator, and stores it in
43 // |current_authenticator_|. Authenticators that can be started in either 45 // |current_authenticator_|. Authenticators that can be started in either
44 // state will be created in |preferred_initial_state|. 46 // state will be created in |preferred_initial_state|.
45 // |resume_callback| is called after |current_authenticator_| is set. 47 // |resume_callback| is called after |current_authenticator_| is set.
46 void CreateAuthenticator(Authenticator::State preferred_initial_state, 48 void CreateAuthenticator(Authenticator::State preferred_initial_state,
47 const base::Closure& resume_callback); 49 const base::Closure& resume_callback);
48 50
49 // Creates a V2Authenticator in state |initial_state| with the given 51 // Creates a V2Authenticator in state |initial_state| with the given
50 // |shared_secret|, then runs |resume_callback|. 52 // |shared_secret|, then runs |resume_callback|.
51 void CreateV2AuthenticatorWithSecret( 53 void CreateV2AuthenticatorWithSecret(
52 Authenticator::State initial_state, 54 Authenticator::State initial_state,
53 const base::Closure& resume_callback, 55 const base::Closure& resume_callback,
54 const std::string& shared_secret); 56 const std::string& shared_secret);
55 57
58 // Used for both authenticators.
56 std::string authentication_tag_; 59 std::string authentication_tag_;
60
61 // Used for shared secret authenticators.
57 FetchSecretCallback fetch_secret_callback_; 62 FetchSecretCallback fetch_secret_callback_;
63
64 // Used for third party authenticators.
65 scoped_ptr<ThirdPartyClientAuthenticator::TokenFetcher> token_fetcher_;
66
67 // Internal NegotiatingClientAuthenticator data.
58 bool method_set_by_host_; 68 bool method_set_by_host_;
59 base::WeakPtrFactory<NegotiatingClientAuthenticator> weak_factory_; 69 base::WeakPtrFactory<NegotiatingClientAuthenticator> weak_factory_;
60 70
61 DISALLOW_COPY_AND_ASSIGN(NegotiatingClientAuthenticator); 71 DISALLOW_COPY_AND_ASSIGN(NegotiatingClientAuthenticator);
62 }; 72 };
63 73
64 } // namespace protocol 74 } // namespace protocol
65 } // namespace remoting 75 } // namespace remoting
66 76
67 #endif // REMOTING_PROTOCOL_NEGOTIATING_CLIENT_AUTHENTICATOR_H_ 77 #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