| Index: remoting/protocol/negotiating_client_authenticator.cc
|
| diff --git a/remoting/protocol/negotiating_client_authenticator.cc b/remoting/protocol/negotiating_client_authenticator.cc
|
| index af5d56bc366454d93835eec27ff01be3e51de7bd..1894bc2258a13bf3ee401ad1ab52cb4a33750565 100644
|
| --- a/remoting/protocol/negotiating_client_authenticator.cc
|
| +++ b/remoting/protocol/negotiating_client_authenticator.cc
|
| @@ -12,6 +12,7 @@
|
| #include "base/logging.h"
|
| #include "base/strings/string_split.h"
|
| #include "remoting/protocol/channel_authenticator.h"
|
| +#include "remoting/protocol/pairing_client_authenticator.h"
|
| #include "remoting/protocol/v2_authenticator.h"
|
| #include "third_party/libjingle/source/talk/xmllite/xmlelement.h"
|
|
|
| @@ -19,11 +20,15 @@ namespace remoting {
|
| namespace protocol {
|
|
|
| NegotiatingClientAuthenticator::NegotiatingClientAuthenticator(
|
| + const std::string& client_pairing_id,
|
| + const std::string& shared_secret,
|
| const std::string& authentication_tag,
|
| const FetchSecretCallback& fetch_secret_callback,
|
| scoped_ptr<ThirdPartyClientAuthenticator::TokenFetcher> token_fetcher,
|
| const std::vector<AuthenticationMethod>& methods)
|
| : NegotiatingAuthenticatorBase(MESSAGE_READY),
|
| + client_pairing_id_(client_pairing_id),
|
| + shared_secret_(shared_secret),
|
| authentication_tag_(authentication_tag),
|
| fetch_secret_callback_(fetch_secret_callback),
|
| token_fetcher_(token_fetcher.Pass()),
|
| @@ -81,14 +86,13 @@ scoped_ptr<buzz::XmlElement> NegotiatingClientAuthenticator::GetNextMessage() {
|
| // If no authentication method has been chosen, see if we can optimistically
|
| // choose one.
|
| scoped_ptr<buzz::XmlElement> result;
|
| - current_authenticator_ = CreatePreferredAuthenticator();
|
| + CreatePreferredAuthenticator();
|
| if (current_authenticator_) {
|
| DCHECK(current_authenticator_->state() == MESSAGE_READY);
|
| result = GetNextMessageInternal();
|
| } else {
|
| result = CreateEmptyAuthenticatorMessage();
|
| }
|
| -
|
| // Include a list of supported methods.
|
| std::stringstream supported_methods(std::stringstream::out);
|
| for (std::vector<AuthenticationMethod>::iterator it = methods_.begin();
|
| @@ -123,10 +127,15 @@ void NegotiatingClientAuthenticator::CreateAuthenticatorForCurrentMethod(
|
| }
|
| }
|
|
|
| -scoped_ptr<Authenticator>
|
| -NegotiatingClientAuthenticator::CreatePreferredAuthenticator() {
|
| - NOTIMPLEMENTED();
|
| - return scoped_ptr<Authenticator>();
|
| +void NegotiatingClientAuthenticator::CreatePreferredAuthenticator() {
|
| + if (!client_pairing_id_.empty() && !shared_secret_.empty()) {
|
| + // If the client specified a pairing id and shared secret, then create a
|
| + // PairingAuthenticator.
|
| + current_authenticator_.reset(new PairingClientAuthenticator(
|
| + client_pairing_id_, shared_secret_, fetch_secret_callback_,
|
| + authentication_tag_));
|
| + current_method_ = AuthenticationMethod::Spake2Pair();
|
| + }
|
| }
|
|
|
| void NegotiatingClientAuthenticator::CreateV2AuthenticatorWithSecret(
|
|
|