token_validator_factory_impl.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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. #ifndef REMOTING_HOST_TOKEN_VALIDATOR_FACTORY_IMPL_H_
  5. #define REMOTING_HOST_TOKEN_VALIDATOR_FACTORY_IMPL_H_
  6. #include <set>
  7. #include <string>
  8. #include "net/url_request/url_request_context_getter.h"
  9. #include "remoting/host/token_validator_base.h"
  10. #include "remoting/protocol/token_validator.h"
  11. namespace remoting {
  12. class RsaKeyPair;
  13. // This class dispenses |TokenValidator| implementations that use a UrlRequest
  14. // to contact a |token_validation_url| and exchange the |token| for a
  15. // |shared_secret|.
  16. class TokenValidatorFactoryImpl : public protocol::TokenValidatorFactory {
  17. public:
  18. // Creates a new factory. |token_url| and |token_validation_url| are the
  19. // third party authentication service URLs, obtained via policy. |key_pair_|
  20. // is used by the host to authenticate with the service by signing the token.
  21. TokenValidatorFactoryImpl(
  22. const ThirdPartyAuthConfig& third_party_auth_config,
  23. scoped_refptr<RsaKeyPair> key_pair,
  24. scoped_refptr<net::URLRequestContextGetter> request_context_getter);
  25. TokenValidatorFactoryImpl(const TokenValidatorFactoryImpl&) = delete;
  26. TokenValidatorFactoryImpl& operator=(const TokenValidatorFactoryImpl&) =
  27. delete;
  28. // TokenValidatorFactory interface.
  29. std::unique_ptr<protocol::TokenValidator> CreateTokenValidator(
  30. const std::string& local_jid,
  31. const std::string& remote_jid) override;
  32. private:
  33. ~TokenValidatorFactoryImpl() override;
  34. ThirdPartyAuthConfig third_party_auth_config_;
  35. scoped_refptr<RsaKeyPair> key_pair_;
  36. scoped_refptr<net::URLRequestContextGetter> request_context_getter_;
  37. };
  38. } // namespace remoting
  39. #endif // REMOTING_HOST_TOKEN_VALIDATOR_FACTORY_IMPL_H_