me2me_host_authenticator_factory.h 2.51 KB
Newer Older
1 2 3 4 5 6 7
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef REMOTING_PROTOCOL_ME2ME_HOST_AUTHENTICATOR_FACTORY_H_
#define REMOTING_PROTOCOL_ME2ME_HOST_AUTHENTICATOR_FACTORY_H_

8
#include <memory>
9
#include <string>
10
#include <vector>
11 12

#include "base/compiler_specific.h"
13
#include "base/macros.h"
14
#include "base/memory/ref_counted.h"
15
#include "remoting/protocol/authenticator.h"
16
#include "remoting/protocol/third_party_host_authenticator.h"
17
#include "remoting/protocol/token_validator.h"
18 19

namespace remoting {
20 21 22

class RsaKeyPair;

23 24
namespace protocol {

25 26
class PairingRegistry;

27 28
class Me2MeHostAuthenticatorFactory : public AuthenticatorFactory {
 public:
29
  // Create a factory that dispenses shared secret authenticators.
30
  static std::unique_ptr<AuthenticatorFactory> CreateWithPin(
31
      bool use_service_account,
32
      const std::string& host_owner,
33
      const std::string& local_cert,
34
      scoped_refptr<RsaKeyPair> key_pair,
35
      std::vector<std::string> required_client_domain_list,
36
      const std::string& pin_hash,
37 38
      scoped_refptr<PairingRegistry> pairing_registry);

39
  // Create a factory that dispenses third party authenticators.
40
  static std::unique_ptr<AuthenticatorFactory> CreateWithThirdPartyAuth(
41
      bool use_service_account,
42
      const std::string& host_owner,
43 44
      const std::string& local_cert,
      scoped_refptr<RsaKeyPair> key_pair,
45
      std::vector<std::string> required_client_domain_list,
46
      scoped_refptr<TokenValidatorFactory> token_validator_factory);
47

48
  Me2MeHostAuthenticatorFactory();
49
  ~Me2MeHostAuthenticatorFactory() override;
50 51

  // AuthenticatorFactory interface.
52
  std::unique_ptr<Authenticator> CreateAuthenticator(
53
      const std::string& local_jid,
54
      const std::string& remote_jid) override;
55 56

 private:
57
  // Used for all host authenticators.
58
  bool use_service_account_;
59
  std::string host_owner_;
60
  std::string local_cert_;
61
  scoped_refptr<RsaKeyPair> key_pair_;
62
  std::vector<std::string> required_client_domain_list_;
63

64 65
  // Used only for PIN-based host authenticators.
  std::string pin_hash_;
66

67
  // Used only for third party host authenticators.
68
  scoped_refptr<TokenValidatorFactory> token_validator_factory_;
69

70 71 72
  // Used only for pairing host authenticators.
  scoped_refptr<PairingRegistry> pairing_registry_;

73 74 75 76 77 78 79
  DISALLOW_COPY_AND_ASSIGN(Me2MeHostAuthenticatorFactory);
};

}  // namespace protocol
}  // namespace remoting

#endif  // REMOTING_PROTOCOL_ME2ME_HOST_AUTHENTICATOR_FACTORY_H_