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

Unified Diff: remoting/protocol/negotiating_client_authenticator.cc

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 side-by-side diff with in-line comments
Download patch
Index: remoting/protocol/negotiating_client_authenticator.cc
diff --git a/remoting/protocol/negotiating_client_authenticator.cc b/remoting/protocol/negotiating_client_authenticator.cc
index c7ab0f5a64f22176d6aa178629dc29c87e14f85a..6210cefed4e9e7a5ae5c9f71c104b460ecffa7b8 100644
--- a/remoting/protocol/negotiating_client_authenticator.cc
+++ b/remoting/protocol/negotiating_client_authenticator.cc
@@ -21,10 +21,12 @@ namespace protocol {
NegotiatingClientAuthenticator::NegotiatingClientAuthenticator(
const std::string& authentication_tag,
const FetchSecretCallback& fetch_secret_callback,
+ scoped_ptr<ThirdPartyClientAuthenticator::TokenFetcher> token_fetcher,
const std::vector<AuthenticationMethod>& methods)
: NegotiatingAuthenticatorBase(MESSAGE_READY),
authentication_tag_(authentication_tag),
fetch_secret_callback_(fetch_secret_callback),
+ token_fetcher_(token_fetcher.Pass()),
method_set_by_host_(false),
weak_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) {
DCHECK(!methods.empty());
@@ -97,9 +99,20 @@ scoped_ptr<buzz::XmlElement> NegotiatingClientAuthenticator::GetNextMessage() {
void NegotiatingClientAuthenticator::CreateAuthenticator(
Authenticator::State preferred_initial_state,
const base::Closure& resume_callback) {
- fetch_secret_callback_.Run(base::Bind(
- &NegotiatingClientAuthenticator::CreateV2AuthenticatorWithSecret,
- weak_factory_.GetWeakPtr(), preferred_initial_state, resume_callback));
+ DCHECK(current_method_.is_valid());
+ if (current_method_.type() == AuthenticationMethod::THIRD_PARTY) {
+ // |ThirdPartyClientAuthenticator| takes ownership of |token_fetcher_|.
+ // The authentication method negotiation logic should guarantee that only
+ // one |ThirdPartyClientAuthenticator| will need to be created per session.
+ DCHECK(token_fetcher_);
+ current_authenticator_.reset(new ThirdPartyClientAuthenticator(
+ token_fetcher_.Pass()));
+ resume_callback.Run();
+ } else {
+ fetch_secret_callback_.Run(base::Bind(
+ &NegotiatingClientAuthenticator::CreateV2AuthenticatorWithSecret,
+ weak_factory_.GetWeakPtr(), preferred_initial_state, resume_callback));
+ }
}
void NegotiatingClientAuthenticator::CreateV2AuthenticatorWithSecret(
« no previous file with comments | « remoting/protocol/negotiating_client_authenticator.h ('k') | remoting/protocol/third_party_authenticator_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698