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

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

Issue 14793021: PairingAuthenticator implementation and plumbing. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef REMOTING_PROTOCOL_PAIRING_CLIENT_AUTHENTICATOR_H_
6 #define REMOTING_PROTOCOL_PAIRING_CLIENT_AUTHENTICATOR_H_
7
8 #include "base/memory/weak_ptr.h"
9 #include "remoting/protocol/authenticator.h"
10
11 namespace remoting {
12
13 class RsaKeyPair;
14
15 namespace protocol {
16
17 class Authenticator;
18
19 typedef base::Callback<void(const std::string& secret)> SecretFetchedCallback;
20 typedef base::Callback<void(
21 const SecretFetchedCallback& secret_fetched_callback)> FetchSecretCallback;
22
23 // PairingClientAuthenticator builds on top of V2Authenticator to add
24 // support for PIN-less authentication via device pairing. If a client
25 // device is already paired, it includes a client id in the initial
26 // authentication message. If the host recognizes the id, it looks up
27 // the corresponding shared secret to authenticate the client. If it
28 // does not recognize the id, it sends an error message to the client,
29 // which will prompt the user for a PIN to use for authentication
30 // instead. In either case, the V2Authenticator is used for
31 // authentication.
32 class PairingClientAuthenticator : public Authenticator {
33 public:
34 PairingClientAuthenticator(
35 const std::string& client_id,
36 const std::string& shared_secret,
37 const FetchSecretCallback& fetch_secret_callback,
38 const std::string& authentication_tag);
39 virtual ~PairingClientAuthenticator() {}
40
41 // Authenticator interface.
42 virtual State state() const OVERRIDE;
43 virtual RejectionReason rejection_reason() const OVERRIDE;
44 virtual void ProcessMessage(const buzz::XmlElement* message,
45 const base::Closure& resume_callback) OVERRIDE;
46 virtual scoped_ptr<buzz::XmlElement> GetNextMessage() OVERRIDE;
47 virtual scoped_ptr<ChannelAuthenticator>
48 CreateChannelAuthenticator() const OVERRIDE;
49
50 private:
51 void CreateV2AuthenticatorWithSecret(const base::Closure& resume_callback,
52 const std::string& secret);
53
54 bool initial_message_sent_;
55 std::string client_id_;
56 const std::string& shared_secret_;
57 FetchSecretCallback fetch_secret_callback_;
58 std::string authentication_tag_;
59 State initial_state_;
60 scoped_ptr<Authenticator> v2_authenticator_;
61 bool pairing_failed_;
62 base::WeakPtrFactory<PairingClientAuthenticator> weak_factory_;
63
64 DISALLOW_COPY_AND_ASSIGN(PairingClientAuthenticator);
65 };
66
67 } // namespace protocol
68 } // namespace remoting
69
70 #endif // REMOTING_PROTOCOL_PAIRING_AUTHENTICATOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698