AWSCognitoAuthorizationNotificationBusBehaviorHandler.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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 <Authorization/AWSCognitoAuthorizationBus.h>
  10. #include <AzCore/Component/TickBus.h>
  11. #include <AzCore/RTTI/BehaviorContext.h>
  12. namespace AWSClientAuth
  13. {
  14. //! Authorization behavior EBus handler
  15. class AWSCognitoAuthorizationNotificationBusBehaviorHandler
  16. : public AWSCognitoAuthorizationNotificationBus::Handler
  17. , public AZ::BehaviorEBusHandler
  18. {
  19. public:
  20. AZ_EBUS_BEHAVIOR_BINDER(AWSCognitoAuthorizationNotificationBusBehaviorHandler, "{F2BCAB42-97FD-41AC-AF7A-7E3BD64B7089}", AZ::SystemAllocator,
  21. OnRequestAWSCredentialsSuccess, OnRequestAWSCredentialsFail
  22. );
  23. void OnRequestAWSCredentialsSuccess(const ClientAuthAWSCredentials& awsCredentials) override
  24. {
  25. AZ::TickBus::QueueFunction([awsCredentials, this]()
  26. {
  27. Call(FN_OnRequestAWSCredentialsSuccess, awsCredentials);
  28. });
  29. }
  30. void OnRequestAWSCredentialsFail(const AZStd::string& error) override
  31. {
  32. AZ::TickBus::QueueFunction([error, this]()
  33. {
  34. Call(FN_OnRequestAWSCredentialsFail, error);
  35. });
  36. }
  37. };
  38. } // namespace AWSClientAuth