Re-land: C++ readability review
[chromium-blink-merge.git] / remoting / protocol / me2me_host_authenticator_factory.h
blob13b8346f9a8618cf98adbea64cb9e3377bd7ee77
1 // Copyright (c) 2012 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.
5 #ifndef REMOTING_PROTOCOL_ME2ME_HOST_AUTHENTICATOR_FACTORY_H_
6 #define REMOTING_PROTOCOL_ME2ME_HOST_AUTHENTICATOR_FACTORY_H_
8 #include <string>
10 #include "base/basictypes.h"
11 #include "base/compiler_specific.h"
12 #include "base/memory/ref_counted.h"
13 #include "base/memory/scoped_ptr.h"
14 #include "remoting/protocol/authentication_method.h"
15 #include "remoting/protocol/authenticator.h"
16 #include "remoting/protocol/third_party_host_authenticator.h"
17 #include "remoting/protocol/token_validator.h"
19 namespace remoting {
21 class RsaKeyPair;
23 namespace protocol {
25 class PairingRegistry;
27 class Me2MeHostAuthenticatorFactory : public AuthenticatorFactory {
28 public:
29 // Create a factory that dispenses shared secret authenticators.
30 static scoped_ptr<AuthenticatorFactory> CreateWithSharedSecret(
31 bool use_service_account,
32 const std::string& host_owner,
33 const std::string& local_cert,
34 scoped_refptr<RsaKeyPair> key_pair,
35 const SharedSecretHash& shared_secret_hash,
36 scoped_refptr<PairingRegistry> pairing_registry);
38 // Create a factory that dispenses third party authenticators.
39 static scoped_ptr<AuthenticatorFactory> CreateWithThirdPartyAuth(
40 bool use_service_account,
41 const std::string& host_owner,
42 const std::string& local_cert,
43 scoped_refptr<RsaKeyPair> key_pair,
44 scoped_ptr<TokenValidatorFactory> token_validator_factory);
46 Me2MeHostAuthenticatorFactory();
47 ~Me2MeHostAuthenticatorFactory() override;
49 // AuthenticatorFactory interface.
50 scoped_ptr<Authenticator> CreateAuthenticator(
51 const std::string& local_jid,
52 const std::string& remote_jid,
53 const buzz::XmlElement* first_message) override;
55 private:
56 // Used for all host authenticators.
57 bool use_service_account_;
58 std::string host_owner_;
59 std::string local_cert_;
60 scoped_refptr<RsaKeyPair> key_pair_;
62 // Used only for shared secret host authenticators.
63 SharedSecretHash shared_secret_hash_;
65 // Used only for third party host authenticators.
66 scoped_ptr<TokenValidatorFactory> token_validator_factory_;
68 // Used only for pairing host authenticators.
69 scoped_refptr<PairingRegistry> pairing_registry_;
71 DISALLOW_COPY_AND_ASSIGN(Me2MeHostAuthenticatorFactory);
74 } // namespace protocol
75 } // namespace remoting
77 #endif // REMOTING_PROTOCOL_ME2ME_HOST_AUTHENTICATOR_FACTORY_H_