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_
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"
24 class PairingRegistry
;
26 class Me2MeHostAuthenticatorFactory
: public AuthenticatorFactory
{
28 // Create a factory that dispenses shared secret authenticators.
29 static scoped_ptr
<AuthenticatorFactory
> CreateWithSharedSecret(
30 bool use_service_account
,
31 const std::string
& host_owner
,
32 const std::string
& local_cert
,
33 scoped_refptr
<RsaKeyPair
> key_pair
,
34 const SharedSecretHash
& shared_secret_hash
,
35 scoped_refptr
<PairingRegistry
> pairing_registry
);
37 // Create a factory that dispenses third party authenticators.
38 static scoped_ptr
<AuthenticatorFactory
> CreateWithThirdPartyAuth(
39 bool use_service_account
,
40 const std::string
& host_owner
,
41 const std::string
& local_cert
,
42 scoped_refptr
<RsaKeyPair
> key_pair
,
43 scoped_ptr
<ThirdPartyHostAuthenticator::TokenValidatorFactory
>
44 token_validator_factory
);
46 // Create a factory that dispenses rejecting authenticators (used when the
47 // host config/policy is inconsistent)
48 static scoped_ptr
<AuthenticatorFactory
> CreateRejecting();
50 Me2MeHostAuthenticatorFactory();
51 virtual ~Me2MeHostAuthenticatorFactory();
53 // AuthenticatorFactory interface.
54 virtual scoped_ptr
<Authenticator
> CreateAuthenticator(
55 const std::string
& local_jid
,
56 const std::string
& remote_jid
,
57 const buzz::XmlElement
* first_message
) OVERRIDE
;
60 // Used for all host authenticators.
61 bool use_service_account_
;
62 std::string host_owner_
;
63 std::string local_cert_
;
64 scoped_refptr
<RsaKeyPair
> key_pair_
;
66 // Used only for shared secret host authenticators.
67 SharedSecretHash shared_secret_hash_
;
69 // Used only for third party host authenticators.
70 scoped_ptr
<ThirdPartyHostAuthenticator::TokenValidatorFactory
>
71 token_validator_factory_
;
73 // Used only for pairing host authenticators.
74 scoped_refptr
<PairingRegistry
> pairing_registry_
;
76 DISALLOW_COPY_AND_ASSIGN(Me2MeHostAuthenticatorFactory
);
79 } // namespace protocol
80 } // namespace remoting
82 #endif // REMOTING_PROTOCOL_ME2ME_HOST_AUTHENTICATOR_FACTORY_H_