Integrating latest from github/staging
Integrating up through commit 5e1bdae
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
constexpr char CognitoUserPoolIdResourceMappingKey[] = "AWSClientAuth.CognitoUserPoolId";
|
||||
constexpr char CognitoAppClientIdResourceMappingKey[] = "AWSClientAuth.CognitoUserPoolAppClientId";
|
||||
constexpr char CognitoIdentityPoolIdResourceMappingKey[] = "AWSClientAuth.CognitoIdentityPoolId";
|
||||
+3
-3
@@ -23,8 +23,8 @@ namespace AWSClientAuth
|
||||
: public AuthenticationProviderInterface
|
||||
{
|
||||
public:
|
||||
AWSCognitoAuthenticationProvider();
|
||||
virtual ~AWSCognitoAuthenticationProvider();
|
||||
AWSCognitoAuthenticationProvider() = default;
|
||||
virtual ~AWSCognitoAuthenticationProvider() = default;
|
||||
|
||||
// AuthenticationProviderInterface overrides
|
||||
bool Initialize(AZStd::weak_ptr<AZ::SettingsRegistryInterface> settingsRegistry) override;
|
||||
@@ -41,8 +41,8 @@ namespace AWSClientAuth
|
||||
void UpdateTokens(const Aws::CognitoIdentityProvider::Model::AuthenticationResultType& authenticationResult);
|
||||
|
||||
protected:
|
||||
AZStd::unique_ptr<AWSCognitoProviderSetting> m_settings;
|
||||
AZStd::string m_session;
|
||||
AZStd::string m_cognitoAppClientId;
|
||||
};
|
||||
|
||||
} // namespace AWSClientAuth
|
||||
|
||||
@@ -68,35 +68,4 @@ namespace AWSClientAuth
|
||||
->Field("OAuthTokensURL", &GoogleProviderSetting::m_oAuthTokensURL);
|
||||
}
|
||||
};
|
||||
|
||||
//! Holds AWS Cognito provider serialized Settings.
|
||||
class AWSCognitoProviderSetting
|
||||
{
|
||||
public:
|
||||
AWSCognitoProviderSetting() = default;
|
||||
~AWSCognitoProviderSetting() = default;
|
||||
|
||||
AZ_TYPE_INFO(AWSCognitoProviderSetting, "{46EF239C-D3CF-4B17-BA68-FD6B3B249305}");
|
||||
|
||||
AZStd::string m_appClientId;
|
||||
|
||||
static void Reflect(AZ::SerializeContext& context)
|
||||
{
|
||||
context.Class<AWSCognitoProviderSetting>()
|
||||
->Field("AppClientId", &AWSCognitoProviderSetting::m_appClientId)
|
||||
;
|
||||
|
||||
AZ::EditContext* editContext = context.GetEditContext();
|
||||
|
||||
if (editContext)
|
||||
{
|
||||
editContext->Class<AWSCognitoProviderSetting>("AWSCognitoProviderSetting", "AWSCognitoProviderSetting Settings")
|
||||
->ClassElement(AZ::Edit::ClassElements::EditorData, "")
|
||||
->Attribute(AZ::Edit::Attributes::Category, "AWSClientAuth")
|
||||
->Attribute(AZ::Edit::Attributes::AutoExpand, true)
|
||||
->Attribute(AZ::Edit::Attributes::AppearsInAddComponentMenu, AZ_CRC_CE("Game"))
|
||||
->DataElement(AZ::Edit::UIHandlers::Default, &AWSCognitoProviderSetting::m_appClientId, "ClientId", "Cognito User Pool App Client Id");
|
||||
}
|
||||
}
|
||||
};
|
||||
} // namespace AWSClientAuth
|
||||
|
||||
@@ -14,27 +14,25 @@
|
||||
|
||||
namespace AWSClientAuth
|
||||
{
|
||||
constexpr char OAUTH_CLIENT_ID_BODY_KEY[] = "client_id";
|
||||
constexpr char OAUTH_CLIENT_SECRET_BODY_KEY[] = "client_secret";
|
||||
constexpr char OAUTH_DEVICE_CODE_BODY_KEY[] = "device_code";
|
||||
constexpr char OAUTH_SCOPE_BODY_KEY[] = "scope";
|
||||
constexpr char OAUTH_SCOPE_BODY_VALUE[] = "profile";
|
||||
constexpr char OAUTH_GRANT_TYPE_BODY_KEY[] = "grant_type";
|
||||
constexpr char OAUTH_REFRESH_TOKEN_BODY_KEY[] = "refresh_token";
|
||||
constexpr char OAUTH_REFRESH_TOKEN_BODY_VALUE[] = "refresh_token";
|
||||
constexpr char OAUTH_RESPONSE_TYPE_BODY_KEY[] = "response_type";
|
||||
|
||||
constexpr char OAUTH_CONTENT_TYPE_HEADER_KEY[] = "Content-Type";
|
||||
constexpr char OAUTH_CONTENT_TYPE_HEADER_VALUE[] = "application/x-www-form-urlencoded";
|
||||
constexpr char OAUTH_CONTENT_LENGTH_HEADER_KEY[] = "Content-Length";
|
||||
|
||||
constexpr char OAUTH_USER_CODE_RESPONSE_KEY[] = "user_code";
|
||||
constexpr char OAUTH_ID_TOKEN_RESPONSE_KEY[] = "id_token";
|
||||
constexpr char OAUTH_ACCESS_TOKEN_RESPONSE_KEY[] = "access_token";
|
||||
constexpr char OAUTH_REFRESH_TOKEN_RESPONSE_KEY[] = "refresh_token";
|
||||
constexpr char OAUTH_EXPIRES_IN_RESPONSE_KEY[] = "expires_in";
|
||||
constexpr char OAUTH_ERROR_RESPONSE_KEY[] = "error";
|
||||
constexpr char OAuthClientIdBodyKey[] = "client_id";
|
||||
constexpr char OAuthClientSecretBodyKey[] = "client_secret";
|
||||
constexpr char OAuthDeviceCodeBodyKey[] = "device_code";
|
||||
constexpr char OAuthScopeBodyKey[] = "scope";
|
||||
constexpr char OAuthScopeBodyValue[] = "profile";
|
||||
constexpr char OAuthGrantTypeBodyKey[] = "grant_type";
|
||||
constexpr char OAuthRefreshTokenBodyKey[] = "refresh_token";
|
||||
constexpr char OAuthRefreshTokenBodyValue[] = "refresh_token";
|
||||
constexpr char OAuthResponseTypeBodyKey[] = "response_type";
|
||||
|
||||
constexpr char OAuthContentTypeHeaderKey[] = "Content-Type";
|
||||
constexpr char OAuthContentTypeHeaderValue[] = "application/x-www-form-urlencoded";
|
||||
constexpr char OAuthContentLengthHeaderKey[] = "Content-Length";
|
||||
|
||||
constexpr char OAuthUserCodeResponseKey[] = "user_code";
|
||||
constexpr char OAuthIdTokenResponseKey[] = "id_token";
|
||||
constexpr char OAuthAccessTokenResponseKey[] = "access_token";
|
||||
constexpr char OAuthRefreshTokenResponseKey[] = "refresh_token";
|
||||
constexpr char OAuthExpiresInResponseKey[] = "expires_in";
|
||||
constexpr char OAuthErrorResponseKey[] = "error";
|
||||
|
||||
} // namespace AWSClientAuth
|
||||
|
||||
-1
@@ -12,7 +12,6 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <Authorization/AWSCognitoAuthorizationTypes.h>
|
||||
#include <aws/identity-management/auth/PersistentCognitoIdentityProvider.h>
|
||||
|
||||
namespace AWSClientAuth
|
||||
|
||||
+5
-3
@@ -13,7 +13,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <Authorization/AWSCognitoAuthorizationBus.h>
|
||||
#include <Authorization/AWSCognitoAuthorizationTypes.h>
|
||||
#include <Authorization/AWSClientAuthPersistentCognitoIdentityProvider.h>
|
||||
#include <Authentication/AuthenticationProviderBus.h>
|
||||
#include <Credential/AWSCredentialBus.h>
|
||||
@@ -34,7 +33,7 @@ namespace AWSClientAuth
|
||||
virtual ~AWSCognitoAuthorizationController();
|
||||
|
||||
// AWSCognitoAuthorizationRequestsBus interface methods
|
||||
bool Initialize(const AZStd::string& settingsRegistryPath) override;
|
||||
bool Initialize() override;
|
||||
void Reset() override;
|
||||
AZStd::string GetIdentityId() override;
|
||||
bool HasPersistedLogins() override;
|
||||
@@ -54,12 +53,15 @@ namespace AWSClientAuth
|
||||
int GetCredentialHandlerOrder() const override;
|
||||
std::shared_ptr<Aws::Auth::AWSCredentialsProvider> GetCredentialsProvider() override;
|
||||
|
||||
AZStd::unique_ptr<CognitoAuthorizationSettings> m_settings;
|
||||
std::shared_ptr<AWSClientAuthPersistentCognitoIdentityProvider> m_persistentCognitoIdentityProvider;
|
||||
std::shared_ptr<AWSClientAuthPersistentCognitoIdentityProvider> m_persistentAnonymousCognitoIdentityProvider;
|
||||
std::shared_ptr<Aws::Auth::CognitoCachingAuthenticatedCredentialsProvider> m_cognitoCachingCredentialsProvider;
|
||||
std::shared_ptr<Aws::Auth::CognitoCachingAnonymousCredentialsProvider> m_cognitoCachingAnonymousCredentialsProvider;
|
||||
|
||||
AZStd::string m_cognitoIdentityPoolId;
|
||||
AZStd::string m_formattedCognitoUserPoolId;
|
||||
AZStd::string m_awsAccountId;
|
||||
|
||||
private:
|
||||
void PersistLoginsAndRefreshAWSCredentials(const AuthenticationTokens& authenticationTokens);
|
||||
|
||||
|
||||
@@ -1,59 +0,0 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <AzCore/Serialization/EditContext.h>
|
||||
|
||||
namespace AWSClientAuth
|
||||
{
|
||||
//! Holds Cognito Authorization Identity pool settings.
|
||||
class CognitoAuthorizationSettings
|
||||
{
|
||||
public:
|
||||
|
||||
AZ_TYPE_INFO(CognitoAuthorizationSettings, "{2F2080CD-E575-42BD-9717-E42E43C13956}");
|
||||
|
||||
static void Reflect(AZ::SerializeContext& context)
|
||||
{
|
||||
context.Class<CognitoAuthorizationSettings>()
|
||||
->Field("CognitoUserPoolId", &CognitoAuthorizationSettings::m_cognitoUserPoolId)
|
||||
->Field("LoginWithAmazonId", &CognitoAuthorizationSettings::m_loginWithAmazonId)
|
||||
->Field("GoogleId", &CognitoAuthorizationSettings::m_googleId)
|
||||
->Field("AWSAccountId", &CognitoAuthorizationSettings::m_awsAccountId)
|
||||
->Field("IdentityPoolId", &CognitoAuthorizationSettings::m_cognitoIdentityPoolId);
|
||||
|
||||
AZ::EditContext* editContext = context.GetEditContext();
|
||||
|
||||
if (editContext)
|
||||
{
|
||||
editContext->Class<CognitoAuthorizationSettings>("CognitoAuthorizationSettings", "CognitoAuthorizationSettings")
|
||||
->ClassElement(AZ::Edit::ClassElements::EditorData, "")
|
||||
->Attribute(AZ::Edit::Attributes::Category, "AWSClientAuth")
|
||||
->Attribute(AZ::Edit::Attributes::AutoExpand, true)
|
||||
->Attribute(AZ::Edit::Attributes::AppearsInAddComponentMenu, AZ_CRC_CE("Game"))
|
||||
->DataElement(AZ::Edit::UIHandlers::Default, &CognitoAuthorizationSettings::m_cognitoUserPoolId, "CognitoUserPoolId", "Cognito User pool Id")
|
||||
->DataElement(AZ::Edit::UIHandlers::Default, &CognitoAuthorizationSettings::m_loginWithAmazonId, "LoginWithAmazonId", "Login with Amazon id. default: www.amazon.com")
|
||||
->DataElement(AZ::Edit::UIHandlers::Default, &CognitoAuthorizationSettings::m_googleId, "Google Endpoint", "Google endpoint. default: accounts.google.com")
|
||||
->DataElement(AZ::Edit::UIHandlers::Default, &CognitoAuthorizationSettings::m_cognitoUserPoolId, "AWSAccountId", "AWS account Cognito for Cognito identity pool")
|
||||
->DataElement(AZ::Edit::UIHandlers::Default, &CognitoAuthorizationSettings::m_cognitoUserPoolId, "IdentityPoolId", "Cognito Identity pool Id")
|
||||
;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
AZStd::string m_cognitoUserPoolId;
|
||||
AZStd::string m_loginWithAmazonId = "www.amazon.com";
|
||||
AZStd::string m_googleId = "accounts.google.com";
|
||||
AZStd::string m_awsAccountId;
|
||||
AZStd::string m_cognitoIdentityPoolId;
|
||||
};
|
||||
} // namespace AWSClientAuth
|
||||
+8
-4
@@ -13,7 +13,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <UserManagement/AWSCognitoUserManagementBus.h>
|
||||
#include <UserManagement/AWSCognitoUserManagementTypes.h>
|
||||
|
||||
namespace AWSClientAuth
|
||||
{
|
||||
@@ -27,7 +26,7 @@ namespace AWSClientAuth
|
||||
virtual ~AWSCognitoUserManagementController();
|
||||
|
||||
// AWSCognitoUserManagementRequestsBus interface methods
|
||||
bool Initialize(const AZStd::string& settingsRegistryPath);
|
||||
bool Initialize() override;
|
||||
void EmailSignUpAsync(const AZStd::string& username, const AZStd::string& password, const AZStd::string& email) override;
|
||||
void PhoneSignUpAsync(const AZStd::string& username, const AZStd::string& password, const AZStd::string& phoneNumber) override;
|
||||
void ConfirmSignUpAsync(const AZStd::string& username, const AZStd::string& confirmationCode) override;
|
||||
@@ -35,8 +34,13 @@ namespace AWSClientAuth
|
||||
void ConfirmForgotPasswordAsync(const AZStd::string& userName, const AZStd::string& confirmationCode, const AZStd::string& newPassword) override;
|
||||
void EnableMFAAsync(const AZStd::string& accessToken) override;
|
||||
|
||||
protected:
|
||||
AZStd::unique_ptr<AWSCognitoUserManagementSetting> m_settings;
|
||||
inline const AZStd::string& GetCognitoAppClientId() const
|
||||
{
|
||||
return m_cognitoAppClientId;
|
||||
}
|
||||
|
||||
private:
|
||||
AZStd::string m_cognitoAppClientId;
|
||||
};
|
||||
|
||||
} // namespace AWSClientAuth
|
||||
|
||||
-50
@@ -1,50 +0,0 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <AzCore/Serialization/EditContext.h>
|
||||
|
||||
namespace AWSClientAuth
|
||||
{
|
||||
|
||||
//! Holds AWS Cognito user management serialized Settings.
|
||||
class AWSCognitoUserManagementSetting
|
||||
{
|
||||
public:
|
||||
AWSCognitoUserManagementSetting() = default;
|
||||
~AWSCognitoUserManagementSetting() = default;
|
||||
|
||||
AZ_TYPE_INFO(AWSCognitoUserManagementSetting, "{58FC34F1-B84B-4677-B986-45A226F0328D}");
|
||||
|
||||
AZStd::string m_appClientId;
|
||||
|
||||
static void Reflect(AZ::SerializeContext& context)
|
||||
{
|
||||
context.Class<AWSCognitoUserManagementSetting>()
|
||||
->Field("AppClientId", &AWSCognitoUserManagementSetting::m_appClientId)
|
||||
;
|
||||
|
||||
AZ::EditContext* editContext = context.GetEditContext();
|
||||
|
||||
if (editContext)
|
||||
{
|
||||
editContext->Class<AWSCognitoUserManagementSetting>("AWSCognitoUserManagementSetting", "AWSCognitoUserManagementSetting Settings")
|
||||
->ClassElement(AZ::Edit::ClassElements::EditorData, "")
|
||||
->Attribute(AZ::Edit::Attributes::Category, "AWSClientAuth")
|
||||
->Attribute(AZ::Edit::Attributes::AutoExpand, true)
|
||||
->Attribute(AZ::Edit::Attributes::AppearsInAddComponentMenu, AZ_CRC_CE("Game"))
|
||||
->DataElement(AZ::Edit::UIHandlers::Default, &AWSCognitoUserManagementSetting::m_appClientId, "ClientId", "Cognito User Pool App Client Id")
|
||||
;
|
||||
}
|
||||
}
|
||||
};
|
||||
} // namespace AWSClientAuth
|
||||
Reference in New Issue
Block a user