Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
sbera87 committed Sep 5, 2024
1 parent 0ccab92 commit b90893b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@


namespace smithy {
constexpr char SIGV4A[] = "aws.auth#sigv4a";

constexpr char BEARER_SIGNER[] = "Bearer";

class BearerTokenAuthScheme : public AuthScheme<AwsCredentialIdentityBase>
{
Expand All @@ -28,7 +27,7 @@ namespace smithy {
explicit BearerTokenAuthScheme(std::shared_ptr<AwsCredentialIdentityResolverT> identityResolver,
const Aws::String& serviceName,
const Aws::String& region)
: AuthScheme(SIGV4A),
: AuthScheme(BEARER_SIGNER),
m_identityResolver{identityResolver},
m_signer{Aws::MakeShared<AwsBearerTokenSigner>("BearerTokenAuthScheme", serviceName, region)}
{
Expand Down
16 changes: 6 additions & 10 deletions tests/aws-cpp-sdk-core-tests/smithy/client/SmithyClientTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -230,21 +230,17 @@ TEST_F(SmithyClientTest, testSigV4a) {
EXPECT_FALSE(res2.GetResult()->GetUri().GetURIString(true).empty());

}

// using AwsCredentialIdentityResolverT = IdentityResolverBase<IdentityT>;
// using AwsCredentialSignerT = AwsSignerBase<IdentityT>;

TEST_F(SmithyClientTest, bearer) {

std::shared_ptr<MyServiceAuthSchemeResolver> authSchemeResolver = Aws::MakeShared<smithy::BearerTokenAuthSchemeResolver>(ALLOCATION_TAG);

Aws::UnorderedMap<Aws::String, SigVariant> authSchemesMap;

smithy::SigV4aAuthScheme::SigV4aAuthSchemeParameters params;
params.serviceName = "MyService";
params.region = "us-west2";
params.operation = "TestOperation2";

Aws::String key{"aws.auth#sigv4a"};
auto credentialsResolver = Aws::MakeShared<smithy::DefaultAwsCredentialIdentityResolver>(ALLOCATION_TAG, credsProviderChain);
Aws::String key{"Bearer"};
auto credentialsResolver = Aws::MakeShared<smithy::DefaultAwsBearerTokenIdentityResolver>(ALLOCATION_TAG);

SigVariant val{smithy::BearerTokenAuthScheme(credentialsResolver, "MyService", "us-west-2")};

Expand Down Expand Up @@ -278,8 +274,8 @@ TEST_F(SmithyClientTest, bearer) {

EXPECT_EQ(res2.IsSuccess(), true);

EXPECT_TRUE(res2.GetResult()->GetSigningAccessKey().empty());
//EXPECT_TRUE(res2.GetResult()->GetSigningAccessKey().empty());

EXPECT_FALSE(res2.GetResult()->GetUri().GetURIString(true).empty());
//EXPECT_FALSE(res2.GetResult()->GetUri().GetURIString(true).empty());

}

0 comments on commit b90893b

Please sign in to comment.