-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Fix build on smithy client with test actually allocating a client * test client auth workflow * test changes * compile fix * adding working tests for sigv4 and sigv4 a * changes to allow mocks for testing * auth a signer changes, test not working * working tests * spell fix * fixes * make test case consistent * remove cout * added cv * fix for warning * fix warning * fix warning * fix warning * fix warning --------- Co-authored-by: SergeyRyabinin <[email protected]>
- Loading branch information
1 parent
611a3c0
commit babff22
Showing
13 changed files
with
625 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 61 additions & 0 deletions
61
src/aws-cpp-sdk-core/include/smithy/identity/auth/built-in/SigV4aAuthScheme.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
/** | ||
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
* SPDX-License-Identifier: Apache-2.0. | ||
*/ | ||
#pragma once | ||
|
||
#include <smithy/identity/auth/AuthScheme.h> | ||
#include <smithy/identity/auth/built-in/SigV4aAuthSchemeOption.h> | ||
|
||
#include <smithy/identity/resolver/built-in/DefaultAwsCredentialIdentityResolver.h> | ||
|
||
#include <smithy/identity/identity/AwsCredentialIdentityBase.h> | ||
#include <smithy/identity/signer/built-in/SigV4aSigner.h> | ||
|
||
|
||
namespace smithy { | ||
constexpr char SIGV4A[] = "aws.auth#sigv4a"; | ||
|
||
|
||
class SigV4aAuthScheme : public AuthScheme<AwsCredentialIdentityBase> | ||
{ | ||
public: | ||
using AwsCredentialIdentityResolverT = IdentityResolverBase<IdentityT>; | ||
using AwsCredentialSignerT = AwsSignerBase<IdentityT>; | ||
using SigV4aAuthSchemeParameters = DefaultAuthSchemeResolverParameters; | ||
|
||
//This allows to override the identity resolver | ||
explicit SigV4aAuthScheme(std::shared_ptr<AwsCredentialIdentityResolverT> identityResolver, | ||
const SigV4aAuthSchemeParameters& parameters) | ||
: AuthScheme(SIGV4A), | ||
m_identityResolver{identityResolver}, | ||
m_signer{Aws::MakeShared<AwsSigV4aSigner>("SigV4aAuthScheme", parameters)} | ||
{ | ||
assert(m_identityResolver); | ||
assert(m_signer); | ||
} | ||
|
||
explicit SigV4aAuthScheme(const SigV4aAuthSchemeParameters& parameters) | ||
: SigV4aAuthScheme(Aws::MakeShared<DefaultAwsCredentialIdentityResolver>("SigV4aAuthScheme"),parameters ) | ||
{ | ||
assert(m_identityResolver); | ||
|
||
assert(m_signer); | ||
} | ||
|
||
virtual ~SigV4aAuthScheme() = default; | ||
|
||
std::shared_ptr<AwsCredentialIdentityResolverT> identityResolver() override | ||
{ | ||
return m_identityResolver; | ||
} | ||
|
||
std::shared_ptr<AwsCredentialSignerT> signer() override | ||
{ | ||
return m_signer; | ||
} | ||
protected: | ||
std::shared_ptr<AwsCredentialIdentityResolverT> m_identityResolver; | ||
std::shared_ptr<AwsCredentialSignerT> m_signer; | ||
}; | ||
} |
16 changes: 16 additions & 0 deletions
16
src/aws-cpp-sdk-core/include/smithy/identity/auth/built-in/SigV4aAuthSchemeOption.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/** | ||
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
* SPDX-License-Identifier: Apache-2.0. | ||
*/ | ||
#pragma once | ||
|
||
#include <smithy/identity/auth/AuthSchemeOption.h> | ||
|
||
namespace smithy { | ||
struct SigV4aAuthSchemeOption | ||
{ | ||
static AuthSchemeOption sigV4aAuthSchemeOption; | ||
}; | ||
|
||
AuthSchemeOption SigV4aAuthSchemeOption::sigV4aAuthSchemeOption = AuthSchemeOption("aws.auth#sigv4a"); | ||
} |
25 changes: 25 additions & 0 deletions
25
src/aws-cpp-sdk-core/include/smithy/identity/auth/built-in/SigV4aAuthSchemeResolver.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/** | ||
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
* SPDX-License-Identifier: Apache-2.0. | ||
*/ | ||
#pragma once | ||
|
||
#include <smithy/identity/auth/AuthSchemeResolverBase.h> | ||
#include <smithy/identity/auth/built-in/SigV4aAuthSchemeOption.h> | ||
|
||
|
||
namespace smithy { | ||
template<typename ServiceAuthSchemeParametersT = DefaultAuthSchemeResolverParameters> | ||
class SigV4aAuthSchemeResolver : public AuthSchemeResolverBase<ServiceAuthSchemeParametersT> | ||
{ | ||
public: | ||
using ServiceAuthSchemeParameters = ServiceAuthSchemeParametersT; | ||
virtual ~SigV4aAuthSchemeResolver() = default; | ||
|
||
Aws::Vector<AuthSchemeOption> resolveAuthScheme(const ServiceAuthSchemeParameters& identityProperties) override | ||
{ | ||
AWS_UNREFERENCED_PARAM(identityProperties); | ||
return {SigV4aAuthSchemeOption::sigV4aAuthSchemeOption}; | ||
} | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.