| OLD | NEW |
| 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/authentication_method.h" | |
| 15 #include "remoting/protocol/authenticator.h" | 14 #include "remoting/protocol/authenticator.h" |
| 16 #include "remoting/protocol/negotiating_authenticator_base.h" | 15 #include "remoting/protocol/negotiating_authenticator_base.h" |
| 17 #include "remoting/protocol/third_party_client_authenticator.h" | 16 #include "remoting/protocol/third_party_client_authenticator.h" |
| 18 | 17 |
| 19 namespace remoting { | 18 namespace remoting { |
| 20 namespace protocol { | 19 namespace protocol { |
| 21 | 20 |
| 22 // Client-side implementation of NegotiatingAuthenticatorBase. | 21 // Client-side implementation of NegotiatingAuthenticatorBase. |
| 23 // See comments in negotiating_authenticator_base.h for a general explanation. | 22 // See comments in negotiating_authenticator_base.h for a general explanation. |
| 24 class NegotiatingClientAuthenticator : public NegotiatingAuthenticatorBase { | 23 class NegotiatingClientAuthenticator : public NegotiatingAuthenticatorBase { |
| 25 public: | 24 public: |
| 26 // TODO(jamiewalch): Pass ClientConfig instead of separate parameters. | 25 // TODO(jamiewalch): Pass ClientConfig instead of separate parameters. |
| 27 NegotiatingClientAuthenticator( | 26 NegotiatingClientAuthenticator( |
| 28 const std::string& client_pairing_id, | 27 const std::string& client_pairing_id, |
| 29 const std::string& shared_secret, | 28 const std::string& shared_secret, |
| 30 const std::string& authentication_tag, | 29 const std::string& authentication_tag, |
| 31 const FetchSecretCallback& fetch_secret_callback, | 30 const FetchSecretCallback& fetch_secret_callback, |
| 32 scoped_ptr<ThirdPartyClientAuthenticator::TokenFetcher> token_fetcher_, | 31 scoped_ptr<ThirdPartyClientAuthenticator::TokenFetcher> token_fetcher_); |
| 33 const std::vector<AuthenticationMethod>& methods); | |
| 34 | 32 |
| 35 ~NegotiatingClientAuthenticator() override; | 33 ~NegotiatingClientAuthenticator() override; |
| 36 | 34 |
| 37 // Overriden from Authenticator. | 35 // Overriden from Authenticator. |
| 38 void ProcessMessage(const buzz::XmlElement* message, | 36 void ProcessMessage(const buzz::XmlElement* message, |
| 39 const base::Closure& resume_callback) override; | 37 const base::Closure& resume_callback) override; |
| 40 scoped_ptr<buzz::XmlElement> GetNextMessage() override; | 38 scoped_ptr<buzz::XmlElement> GetNextMessage() override; |
| 41 | 39 |
| 42 private: | 40 private: |
| 43 // (Asynchronously) creates an authenticator, and stores it in | 41 // (Asynchronously) creates an authenticator, and stores it in |
| (...skipping 29 matching lines...) Expand all Loading... |
| 73 // Used for all authenticators. | 71 // Used for all authenticators. |
| 74 std::string authentication_tag_; | 72 std::string authentication_tag_; |
| 75 | 73 |
| 76 // Used for shared secret authenticators. | 74 // Used for shared secret authenticators. |
| 77 FetchSecretCallback fetch_secret_callback_; | 75 FetchSecretCallback fetch_secret_callback_; |
| 78 | 76 |
| 79 // Used for third party authenticators. | 77 // Used for third party authenticators. |
| 80 scoped_ptr<ThirdPartyClientAuthenticator::TokenFetcher> token_fetcher_; | 78 scoped_ptr<ThirdPartyClientAuthenticator::TokenFetcher> token_fetcher_; |
| 81 | 79 |
| 82 // Internal NegotiatingClientAuthenticator data. | 80 // Internal NegotiatingClientAuthenticator data. |
| 83 bool method_set_by_host_; | 81 bool method_set_by_host_ = false; |
| 84 base::WeakPtrFactory<NegotiatingClientAuthenticator> weak_factory_; | 82 base::WeakPtrFactory<NegotiatingClientAuthenticator> weak_factory_; |
| 85 | 83 |
| 86 DISALLOW_COPY_AND_ASSIGN(NegotiatingClientAuthenticator); | 84 DISALLOW_COPY_AND_ASSIGN(NegotiatingClientAuthenticator); |
| 87 }; | 85 }; |
| 88 | 86 |
| 89 } // namespace protocol | 87 } // namespace protocol |
| 90 } // namespace remoting | 88 } // namespace remoting |
| 91 | 89 |
| 92 #endif // REMOTING_PROTOCOL_NEGOTIATING_CLIENT_AUTHENTICATOR_H_ | 90 #endif // REMOTING_PROTOCOL_NEGOTIATING_CLIENT_AUTHENTICATOR_H_ |
| OLD | NEW |