AWSClientAuthBus.h 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /*
  2. * Copyright (c) Contributors to the Open 3D Engine Project.
  3. * For complete copyright and license terms please see the LICENSE at the root of this distribution.
  4. *
  5. * SPDX-License-Identifier: Apache-2.0 OR MIT
  6. *
  7. */
  8. #pragma once
  9. #include <AzCore/EBus/EBus.h>
  10. #include <memory>
  11. namespace Aws
  12. {
  13. namespace CognitoIdentityProvider
  14. {
  15. class CognitoIdentityProviderClient;
  16. }
  17. namespace CognitoIdentity
  18. {
  19. class CognitoIdentityClient;
  20. }
  21. }
  22. namespace AWSClientAuth
  23. {
  24. //! Abstract class for AWS client auth requests.
  25. class IAWSClientAuthRequests
  26. {
  27. public:
  28. AZ_TYPE_INFO(IAWSClientAuthRequests, "{1798CB8B-A334-40BD-913A-4739BF939201}");
  29. //! std shared_ptr as the ownership has to be shared with AWS Native SDK.
  30. //! @return AWS Native SDK Cognito IDP client
  31. virtual std::shared_ptr<Aws::CognitoIdentityProvider::CognitoIdentityProviderClient> GetCognitoIDPClient() = 0;
  32. //! std shared_ptr as the ownership has to be shared with AWS Native SDK.
  33. //! @return AWS Native SDK Cognito Identity client
  34. virtual std::shared_ptr<Aws::CognitoIdentity::CognitoIdentityClient> GetCognitoIdentityClient() = 0;
  35. //! Sanity check for Cognito identity and user controllers to see if they have been configured. Gem will skip set up of controllers
  36. //! when configuration is missing to avoid making calls to Cognito that are guaranteed to fail.
  37. //! @return True, the controllers configured to support user and identify management have been initialized.
  38. //! If False, then either user pool or identity pool configuration is missing. Refer to the Gem documentation about how to provide this configuration.
  39. virtual bool HasCognitoControllers() const = 0;
  40. };
  41. //! Responsible for fetching AWS Cognito IDP and Identity service client objects.
  42. class AWSClientAuthRequests
  43. : public AZ::EBusTraits
  44. {
  45. public:
  46. //////////////////////////////////////////////////////////////////////////
  47. // EBusTraits overrides
  48. using MutexType = AZ::NullMutex;
  49. static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Single;
  50. static const AZ::EBusAddressPolicy AddressPolicy = AZ::EBusAddressPolicy::Single;
  51. //////////////////////////////////////////////////////////////////////////
  52. };
  53. using AWSClientAuthRequestBus = AZ::EBus<IAWSClientAuthRequests, AWSClientAuthRequests>;
  54. } // namespace AWSClientAuth