GoogleAuthenticationProvider.h 1.5 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 <Authentication/AuthenticationProviderInterface.h>
  10. #include <Authentication/AuthenticationProviderTypes.h>
  11. #include <aws/core/utils/json/JsonSerializer.h>
  12. namespace AWSClientAuth
  13. {
  14. //! Implements OAuth2.0 device flow for Google authentication service.
  15. class GoogleAuthenticationProvider
  16. : public AuthenticationProviderInterface
  17. {
  18. public:
  19. GoogleAuthenticationProvider();
  20. virtual ~GoogleAuthenticationProvider();
  21. // AuthenticationProviderInterface overrides
  22. bool Initialize() override;
  23. void PasswordGrantSingleFactorSignInAsync(const AZStd::string& username, const AZStd::string& password) override;
  24. void PasswordGrantMultiFactorSignInAsync(const AZStd::string& username, const AZStd::string& password) override;
  25. void PasswordGrantMultiFactorConfirmSignInAsync(const AZStd::string& username, const AZStd::string& confirmationCode) override;
  26. void DeviceCodeGrantSignInAsync() override;
  27. void DeviceCodeGrantConfirmSignInAsync() override;
  28. void RefreshTokensAsync() override;
  29. private:
  30. void UpdateTokens(const Aws::Utils::Json::JsonView& jsonView);
  31. protected:
  32. AZStd::unique_ptr<GoogleProviderSetting> m_settings;
  33. private:
  34. AZStd::string m_cachedDeviceCode;
  35. };
  36. } // namespace AWSClientAuth