Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
sbera87 committed Sep 9, 2024
1 parent 341d524 commit a077743
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,12 @@
#pragma once

#include <smithy/identity/auth/AuthScheme.h>
#include <smithy/identity/auth/built-in/BearerTokenAuthSchemeOption.h>
#include <smithy/identity/identity/AwsBearerTokenIdentityBase.h>
#include <smithy/identity/resolver/AwsBearerTokenIdentityResolver.h>
#include <smithy/identity/signer/built-in/BearerTokenSigner.h>

namespace smithy
{
constexpr char BEARER_SCHEME[] = "smithy.api#HTTPBearerAuth";

class BearerTokenAuthScheme : public AuthScheme<AwsBearerTokenIdentityBase>
{
public:
Expand All @@ -24,7 +22,8 @@ class BearerTokenAuthScheme : public AuthScheme<AwsBearerTokenIdentityBase>
explicit BearerTokenAuthScheme(
std::shared_ptr<AwsCredentialIdentityResolverT> identityResolver,
const Aws::String &serviceName, const Aws::String &region)
: AuthScheme(BEARER_SCHEME), m_identityResolver{identityResolver},
: AuthScheme(smithy::BearerTokenAuthSchemeOption::BEARER_SCHEME),
m_identityResolver{identityResolver},
m_signer{Aws::MakeShared<smithy::BearerTokenSigner>(
"BearerTokenAuthScheme", serviceName, region)}
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,16 @@
#pragma once

#include <smithy/identity/auth/AuthSchemeOption.h>
#include <smithy/identity/auth/built-in/BearerTokenAuthScheme.h>
namespace smithy
{
struct BearerTokenAuthSchemeOption
{
static AuthSchemeOption bearerTokenAuthSchemeOption;
static char BEARER_SCHEME[];
};

char BearerTokenAuthSchemeOption::BEARER_SCHEME[] = "smithy.api#HTTPBearerAuth";

AuthSchemeOption BearerTokenAuthSchemeOption::bearerTokenAuthSchemeOption =
AuthSchemeOption(BEARER_SCHEME);
} // namespace smithy
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,12 @@
namespace smithy
{

static const char SSO_DEFAULT_BEARER_TOKEN_PROVIDER_CHAIN_LOG_TAG[] =
"SSOBearerTokenProvider";
static const char BEARER_TOKEN_PROVIDER_CHAIN_LOG_TAG[] = "BearerTokenProvider";

class AwsBearerTokenIdentityResolver
: public IdentityResolverBase<AwsBearerTokenIdentityBase>
{
public:
static const char BEARER_TOKEN_PROVIDER_CHAIN_LOG_TAG[];

using IdentityT = AwsBearerTokenIdentity;
virtual ~AwsBearerTokenIdentityResolver() = default;

Expand Down Expand Up @@ -90,6 +88,10 @@ class DefaultAwsBearerTokenIdentityResolver
DefaultAwsBearerTokenIdentityResolver()
: AwsBearerTokenIdentityResolver(
{Aws::MakeShared<Aws::Auth::SSOBearerTokenProvider>(
SSO_DEFAULT_BEARER_TOKEN_PROVIDER_CHAIN_LOG_TAG)}){};
"SSOBearerTokenProvider")}){};
};
const char
AwsBearerTokenIdentityResolver::BEARER_TOKEN_PROVIDER_CHAIN_LOG_TAG[] =
"BearerTokenProvider";

} // namespace smithy
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ TEST_F(SmithyClientTest, bearer)

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

Aws::String key{"smithy.api#HTTPBearerAuth"};
Aws::String key{smithy::BearerTokenAuthSchemeOption::BEARER_SCHEME};

std::shared_ptr<smithy::AwsBearerTokenIdentityResolver> resolver =
Aws::MakeShared<TestAwsBearerTokenIdentityResolver>(ALLOCATION_TAG);
Expand Down

0 comments on commit a077743

Please sign in to comment.