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

Side by Side Diff: remoting/protocol/pairing_client_authenticator.cc

Issue 15685008: Show a 'remember me' checkbox in the web-app when connecting to a host that supports pairing. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Reviewer comments. Created 7 years, 7 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 | Annotate | Revision Log
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 #include "remoting/protocol/pairing_client_authenticator.h" 5 #include "remoting/protocol/pairing_client_authenticator.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "remoting/base/constants.h" 9 #include "remoting/base/constants.h"
10 #include "remoting/base/rsa_key_pair.h" 10 #include "remoting/base/rsa_key_pair.h"
(...skipping 23 matching lines...) Expand all
34 34
35 PairingClientAuthenticator::~PairingClientAuthenticator() { 35 PairingClientAuthenticator::~PairingClientAuthenticator() {
36 } 36 }
37 37
38 void PairingClientAuthenticator::CreateV2AuthenticatorWithPIN( 38 void PairingClientAuthenticator::CreateV2AuthenticatorWithPIN(
39 State initial_state, 39 State initial_state,
40 const SetAuthenticatorCallback& set_authenticator_callback) { 40 const SetAuthenticatorCallback& set_authenticator_callback) {
41 SecretFetchedCallback callback = base::Bind( 41 SecretFetchedCallback callback = base::Bind(
42 &PairingClientAuthenticator::OnPinFetched, 42 &PairingClientAuthenticator::OnPinFetched,
43 weak_factory_.GetWeakPtr(), initial_state, set_authenticator_callback); 43 weak_factory_.GetWeakPtr(), initial_state, set_authenticator_callback);
44 fetch_pin_callback_.Run(callback); 44 fetch_pin_callback_.Run(true, callback);
45 } 45 }
46 46
47 void PairingClientAuthenticator::AddPairingElements(buzz::XmlElement* message) { 47 void PairingClientAuthenticator::AddPairingElements(buzz::XmlElement* message) {
48 // If the client id and secret have not yet been sent, do so now. Note that 48 // If the client id and secret have not yet been sent, do so now. Note that
49 // in this case the V2Authenticator is being used optimistically to send the 49 // in this case the V2Authenticator is being used optimistically to send the
50 // first message of the SPAKE exchange since we don't yet know whether or not 50 // first message of the SPAKE exchange since we don't yet know whether or not
51 // the host will accept the client id or request that we fall back to the PIN. 51 // the host will accept the client id or request that we fall back to the PIN.
52 if (!sent_client_id_) { 52 if (!sent_client_id_) {
53 buzz::XmlElement* pairing_tag = new buzz::XmlElement(kPairingInfoTag); 53 buzz::XmlElement* pairing_tag = new buzz::XmlElement(kPairingInfoTag);
54 pairing_tag->AddAttr(kClientIdAttribute, client_id_); 54 pairing_tag->AddAttr(kClientIdAttribute, client_id_);
55 message->AddElement(pairing_tag); 55 message->AddElement(pairing_tag);
56 sent_client_id_ = true; 56 sent_client_id_ = true;
57 } 57 }
58 } 58 }
59 59
60 void PairingClientAuthenticator::OnPinFetched( 60 void PairingClientAuthenticator::OnPinFetched(
61 State initial_state, 61 State initial_state,
62 const SetAuthenticatorCallback& callback, 62 const SetAuthenticatorCallback& callback,
63 const std::string& pin) { 63 const std::string& pin) {
64 callback.Run(V2Authenticator::CreateForClient( 64 callback.Run(V2Authenticator::CreateForClient(
65 AuthenticationMethod::ApplyHashFunction( 65 AuthenticationMethod::ApplyHashFunction(
66 AuthenticationMethod::HMAC_SHA256, 66 AuthenticationMethod::HMAC_SHA256,
67 authentication_tag_, pin), 67 authentication_tag_, pin),
68 initial_state)); 68 initial_state));
69 } 69 }
70 70
71 } // namespace protocol 71 } // namespace protocol
72 } // namespace remoting 72 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/protocol/negotiating_client_authenticator.cc ('k') | remoting/resources/remoting_strings.grd » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698