blob: 92774419cac1b297ce02d37a24cca6288e74998b [file] [log] [blame]
[email protected]6434bfe2013-05-22 09:00:231// 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_HOST_AUTHENTICATOR_H_
6#define REMOTING_PROTOCOL_PAIRING_HOST_AUTHENTICATOR_H_
7
avi5a080f012015-12-22 23:15:438#include "base/macros.h"
[email protected]6434bfe2013-05-22 09:00:239#include "base/memory/weak_ptr.h"
10#include "remoting/protocol/pairing_authenticator_base.h"
[email protected]40dade32013-06-14 07:08:1111#include "remoting/protocol/pairing_registry.h"
[email protected]6434bfe2013-05-22 09:00:2312
13namespace remoting {
[email protected]6434bfe2013-05-22 09:00:2314namespace protocol {
15
16class PairingRegistry;
17
18class PairingHostAuthenticator : public PairingAuthenticatorBase {
19 public:
20 PairingHostAuthenticator(
21 scoped_refptr<PairingRegistry> pairing_registry,
sergeyu12e320a2016-03-08 18:10:2822 const CreateBaseAuthenticatorCallback& create_base_authenticator_callback,
[email protected]6434bfe2013-05-22 09:00:2323 const std::string& pin);
dcheng562aba52014-10-21 12:30:1424 ~PairingHostAuthenticator() override;
[email protected]6434bfe2013-05-22 09:00:2325
sergeyu843ef122016-03-17 01:44:1726 // Initialize the authenticator with the given |client_id| in
27 // |preferred_initial_state|.
28 void Initialize(const std::string& client_id,
29 Authenticator::State preferred_initial_state,
30 const base::Closure& resume_callback);
31
[email protected]6434bfe2013-05-22 09:00:2332 // Authenticator interface.
dcheng562aba52014-10-21 12:30:1433 State state() const override;
34 RejectionReason rejection_reason() const override;
[email protected]6434bfe2013-05-22 09:00:2335
36 private:
sergeyu12e320a2016-03-08 18:10:2837 // PairingAuthenticatorBase overrides.
38 void CreateSpakeAuthenticatorWithPin(
[email protected]6434bfe2013-05-22 09:00:2339 State initial_state,
sergeyu12e320a2016-03-08 18:10:2840 const base::Closure& resume_callback) override;
[email protected]6434bfe2013-05-22 09:00:2341
sergeyu843ef122016-03-17 01:44:1742 // Continue initializing once the pairing information for the client id has
43 // been received.
44 void InitializeWithPairing(Authenticator::State preferred_initial_state,
45 const base::Closure& resume_callback,
46 PairingRegistry::Pairing pairing);
[email protected]40dade32013-06-14 07:08:1147
[email protected]6434bfe2013-05-22 09:00:2348 // Protocol state.
49 scoped_refptr<PairingRegistry> pairing_registry_;
sergeyu12e320a2016-03-08 18:10:2850 CreateBaseAuthenticatorCallback create_base_authenticator_callback_;
51 std::string pin_;
52 bool protocol_error_ = false;
53 bool waiting_for_paired_secret_ = false;
[email protected]6434bfe2013-05-22 09:00:2354
55 base::WeakPtrFactory<PairingHostAuthenticator> weak_factory_;
56
57 DISALLOW_COPY_AND_ASSIGN(PairingHostAuthenticator);
58};
59
60} // namespace protocol
61} // namespace remoting
62
63#endif // REMOTING_PROTOCOL_PAIRING_AUTHENTICATOR_H_