From e45be08cabc532a3a7daee1ef3509235ae8bb941 Mon Sep 17 00:00:00 2001 From: Josh Elkins Date: Fri, 14 Mar 2025 17:06:01 -0500 Subject: [PATCH 1/8] feat: Add support for S3 Express customization --- .../ClientRuntime/Config/Context+Config.swift | 28 +++++++++++++++++++ .../Config/IdentityPropertyKeys.swift | 17 +++++++++++ .../EndpointResolverMiddleware.swift | 2 ++ .../EndpointsAuthSchemeResolver.swift | 6 +++- .../Middlewares/AuthSchemeMiddleware.swift | 4 ++- Sources/SmithyHTTPAuth/CRTAdapters.swift | 1 + .../SigningAlgorithm.swift | 2 ++ .../OperationEndpointResolverMiddleware.kt | 3 +- .../MiddlewareExecutionGenerator.kt | 1 + 9 files changed, 61 insertions(+), 3 deletions(-) create mode 100644 Sources/ClientRuntime/Config/Context+Config.swift create mode 100644 Sources/ClientRuntime/Config/IdentityPropertyKeys.swift diff --git a/Sources/ClientRuntime/Config/Context+Config.swift b/Sources/ClientRuntime/Config/Context+Config.swift new file mode 100644 index 000000000..1d0c6849c --- /dev/null +++ b/Sources/ClientRuntime/Config/Context+Config.swift @@ -0,0 +1,28 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + +import class Smithy.Context +import class Smithy.ContextBuilder +import struct Smithy.AttributeKey + +public extension Context { + + var clientConfig: DefaultClientConfiguration? { + get { get(key: clientConfigKey) } + set { set(key: clientConfigKey, value: newValue) } + } +} + +public extension ContextBuilder { + + func withClientConfig(value: DefaultClientConfiguration?) -> Self { + attributes.set(key: clientConfigKey, value: value) + return self + } +} + +private let clientConfigKey: AttributeKey = AttributeKey(name: "SmithySwiftClientConfig") diff --git a/Sources/ClientRuntime/Config/IdentityPropertyKeys.swift b/Sources/ClientRuntime/Config/IdentityPropertyKeys.swift new file mode 100644 index 000000000..acf2f491c --- /dev/null +++ b/Sources/ClientRuntime/Config/IdentityPropertyKeys.swift @@ -0,0 +1,17 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + +import struct Smithy.AttributeKey + +public enum IdentityPropertyKeys { + + /// The service client config to be used in credential resolution. + /// + /// Used only in conjunction with the `awsv4-s3express` auth scheme, which generates bucket-specific credentials + /// for use with the S3 Express service. + public static let clientConfig = AttributeKey(name: "ClientRuntimeClientConfig") +} diff --git a/Sources/ClientRuntime/Endpoints/EndpointResolverMiddleware.swift b/Sources/ClientRuntime/Endpoints/EndpointResolverMiddleware.swift index af6f38f7e..557a7502b 100644 --- a/Sources/ClientRuntime/Endpoints/EndpointResolverMiddleware.swift +++ b/Sources/ClientRuntime/Endpoints/EndpointResolverMiddleware.swift @@ -53,6 +53,8 @@ extension EndpointResolverMiddleware: ApplyEndpoint { signingName = param.signingName case .sigV4A(let param): signingName = param.signingName + case .sigV4S3Express(let param): + signingName = param.signingName case .none: break } diff --git a/Sources/ClientRuntime/Endpoints/EndpointsAuthSchemeResolver.swift b/Sources/ClientRuntime/Endpoints/EndpointsAuthSchemeResolver.swift index fb604bb38..cc5aea4f0 100644 --- a/Sources/ClientRuntime/Endpoints/EndpointsAuthSchemeResolver.swift +++ b/Sources/ClientRuntime/Endpoints/EndpointsAuthSchemeResolver.swift @@ -9,6 +9,7 @@ public enum EndpointsAuthScheme: Equatable { case sigV4(SigV4Parameters) case sigV4A(SigV4AParameters) + case sigV4S3Express(SigV4Parameters) case none /// The name of the auth scheme @@ -16,6 +17,7 @@ public enum EndpointsAuthScheme: Equatable { switch self { case .sigV4: return "sigv4" case .sigV4A: return "sigv4a" + case .sigV4S3Express: return "sigv4-s3express" case .none: return "none" } } @@ -33,6 +35,8 @@ extension EndpointsAuthScheme { self = .sigV4(try SigV4Parameters(from: dictionary)) case "sigv4a": self = .sigV4A(try SigV4AParameters(from: dictionary)) + case "sigv4-s3express": + self = .sigV4S3Express(try SigV4Parameters(from: dictionary)) case "none": self = .none default: @@ -108,7 +112,7 @@ public struct DefaultEndpointsAuthSchemeResolver: EndpointsAuthSchemeResolver { /// Supported auth schemes by the SDK let supportedAuthSchemes: Set - public init(supportedAuthSchemes: Set = ["sigv4", "sigv4a", "none"]) { + public init(supportedAuthSchemes: Set = ["sigv4", "sigv4a", "sigv4-s3express", "none"]) { self.supportedAuthSchemes = supportedAuthSchemes } diff --git a/Sources/ClientRuntime/Networking/Http/Middlewares/AuthSchemeMiddleware.swift b/Sources/ClientRuntime/Networking/Http/Middlewares/AuthSchemeMiddleware.swift index 3bc2390dc..ceb26bb6a 100644 --- a/Sources/ClientRuntime/Networking/Http/Middlewares/AuthSchemeMiddleware.swift +++ b/Sources/ClientRuntime/Networking/Http/Middlewares/AuthSchemeMiddleware.swift @@ -73,7 +73,9 @@ extension AuthSchemeMiddleware: SelectAuthScheme { context: attributes ) // Resolve identity using the resolver from auth scheme - let identity = try await identityResolver.getIdentity(identityProperties: option.identityProperties) + var modifiedIdentityProperties = option.identityProperties + modifiedIdentityProperties.set(key: IdentityPropertyKeys.clientConfig, value: attributes.clientConfig) + let identity = try await identityResolver.getIdentity(identityProperties: modifiedIdentityProperties) // Save selected auth scheme selectedAuthScheme = SelectedAuthScheme( schemeID: option.schemeID, diff --git a/Sources/SmithyHTTPAuth/CRTAdapters.swift b/Sources/SmithyHTTPAuth/CRTAdapters.swift index e3f395075..27c77c417 100644 --- a/Sources/SmithyHTTPAuth/CRTAdapters.swift +++ b/Sources/SmithyHTTPAuth/CRTAdapters.swift @@ -26,6 +26,7 @@ extension SigningAlgorithm { switch self { case .sigv4: return .signingV4 case .sigv4a: return .signingV4Asymmetric + case .sigv4s3express: return .signingV4S3Express } } } diff --git a/Sources/SmithyHTTPAuthAPI/SigningConfigFields/SigningAlgorithm.swift b/Sources/SmithyHTTPAuthAPI/SigningConfigFields/SigningAlgorithm.swift index 098272da3..c4f06ef09 100644 --- a/Sources/SmithyHTTPAuthAPI/SigningConfigFields/SigningAlgorithm.swift +++ b/Sources/SmithyHTTPAuthAPI/SigningConfigFields/SigningAlgorithm.swift @@ -12,4 +12,6 @@ public enum SigningAlgorithm: String { case sigv4 /// Signature Version 4 Asymmetric case sigv4a + /// Signature Version 4 for S3 Express + case sigv4s3express = "sigv4-s3express" } diff --git a/smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/integration/middlewares/OperationEndpointResolverMiddleware.kt b/smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/integration/middlewares/OperationEndpointResolverMiddleware.kt index 294094ae6..e4b5de747 100644 --- a/smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/integration/middlewares/OperationEndpointResolverMiddleware.kt +++ b/smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/integration/middlewares/OperationEndpointResolverMiddleware.kt @@ -52,8 +52,9 @@ open class OperationEndpointResolverMiddleware( // Write code that saves endpoint params to middleware context for use in auth scheme middleware when using rules-based auth scheme resolvers if (AuthSchemeResolverGenerator.usesRulesBasedAuthResolver(ctx)) { writer.write( - "context.set(key: \$N(name: \"EndpointParams\"), value: endpointParamsBlock(context))", + "context.set(key: \$N(name: \$S), value: endpointParamsBlock(context))", SmithyTypes.AttributeKey, + "EndpointParams", ) } diff --git a/smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/middleware/MiddlewareExecutionGenerator.kt b/smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/middleware/MiddlewareExecutionGenerator.kt index 6d9fa165a..06d10a608 100644 --- a/smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/middleware/MiddlewareExecutionGenerator.kt +++ b/smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/middleware/MiddlewareExecutionGenerator.kt @@ -91,6 +91,7 @@ class MiddlewareExecutionGenerator( // FIXME it over indents if i add another indent, come up with better way to properly indent or format for swift + writer.write(" .withClientConfig(value: config)") writer.write(" .withMethod(value: .\$L)", httpMethod) writer.write(" .withServiceName(value: serviceName)") writer.write(" .withOperation(value: \$S)", op.toLowerCamelCase()) From 0defc56abdf02640becb5b1b8df08eeb4f8239af Mon Sep 17 00:00:00 2001 From: Josh Elkins Date: Fri, 14 Mar 2025 17:54:15 -0500 Subject: [PATCH 2/8] Fix codegen tests --- .../smithy/swift/codegen/HttpProtocolClientGeneratorTests.kt | 2 ++ .../swift/codegen/requestandresponse/EventStreamTests.kt | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/smithy-swift-codegen/src/test/kotlin/software/amazon/smithy/swift/codegen/HttpProtocolClientGeneratorTests.kt b/smithy-swift-codegen/src/test/kotlin/software/amazon/smithy/swift/codegen/HttpProtocolClientGeneratorTests.kt index 2ace6c4f3..57f725f68 100644 --- a/smithy-swift-codegen/src/test/kotlin/software/amazon/smithy/swift/codegen/HttpProtocolClientGeneratorTests.kt +++ b/smithy-swift-codegen/src/test/kotlin/software/amazon/smithy/swift/codegen/HttpProtocolClientGeneratorTests.kt @@ -158,6 +158,7 @@ extension RestJsonProtocolClient { contents.shouldSyntacticSanityCheck() val expectedFragment = """ let context = Smithy.ContextBuilder() + .withClientConfig(value: config) .withMethod(value: .post) .withServiceName(value: serviceName) .withOperation(value: "getStatus") @@ -190,6 +191,7 @@ extension RestJsonProtocolClient { val expected = """ public func allocateWidget(input: AllocateWidgetInput) async throws -> AllocateWidgetOutput { let context = Smithy.ContextBuilder() + .withClientConfig(value: config) .withMethod(value: .post) .withServiceName(value: serviceName) .withOperation(value: "allocateWidget") diff --git a/smithy-swift-codegen/src/test/kotlin/software/amazon/smithy/swift/codegen/requestandresponse/EventStreamTests.kt b/smithy-swift-codegen/src/test/kotlin/software/amazon/smithy/swift/codegen/requestandresponse/EventStreamTests.kt index 507b1dafd..65430919c 100644 --- a/smithy-swift-codegen/src/test/kotlin/software/amazon/smithy/swift/codegen/requestandresponse/EventStreamTests.kt +++ b/smithy-swift-codegen/src/test/kotlin/software/amazon/smithy/swift/codegen/requestandresponse/EventStreamTests.kt @@ -210,9 +210,10 @@ extension EventStreamTestClientTypes.TestStream { val context = setupTests("eventstream.smithy", "aws.protocoltests.restjson#TestService") println(context.manifest.files) val contents = getFileContents(context.manifest, "Sources/Example/EventStreamTestClient.swift") - var expected = """ + val expected = """ public func testStreamOp(input: TestStreamOpInput) async throws -> TestStreamOpOutput { let context = Smithy.ContextBuilder() + .withClientConfig(value: config) .withMethod(value: .post) .withServiceName(value: serviceName) .withOperation(value: "testStreamOp") From fa8c6d2070c2982e8728af44b04cedf4b5562e88 Mon Sep 17 00:00:00 2001 From: Josh Elkins Date: Sun, 16 Mar 2025 11:41:49 -0500 Subject: [PATCH 3/8] Fix swiftlint --- Sources/ClientRuntime/Config/Context+Config.swift | 3 ++- .../Http/Middlewares/AuthSchemeMiddleware.swift | 9 +++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/Sources/ClientRuntime/Config/Context+Config.swift b/Sources/ClientRuntime/Config/Context+Config.swift index 1d0c6849c..6bce8c8a6 100644 --- a/Sources/ClientRuntime/Config/Context+Config.swift +++ b/Sources/ClientRuntime/Config/Context+Config.swift @@ -25,4 +25,5 @@ public extension ContextBuilder { } } -private let clientConfigKey: AttributeKey = AttributeKey(name: "SmithySwiftClientConfig") +private let clientConfigKey: AttributeKey = + AttributeKey(name: "SmithySwiftClientConfig") diff --git a/Sources/ClientRuntime/Networking/Http/Middlewares/AuthSchemeMiddleware.swift b/Sources/ClientRuntime/Networking/Http/Middlewares/AuthSchemeMiddleware.swift index ceb26bb6a..15f3eba75 100644 --- a/Sources/ClientRuntime/Networking/Http/Middlewares/AuthSchemeMiddleware.swift +++ b/Sources/ClientRuntime/Networking/Http/Middlewares/AuthSchemeMiddleware.swift @@ -74,8 +74,13 @@ extension AuthSchemeMiddleware: SelectAuthScheme { ) // Resolve identity using the resolver from auth scheme var modifiedIdentityProperties = option.identityProperties - modifiedIdentityProperties.set(key: IdentityPropertyKeys.clientConfig, value: attributes.clientConfig) - let identity = try await identityResolver.getIdentity(identityProperties: modifiedIdentityProperties) + modifiedIdentityProperties.set( + key: IdentityPropertyKeys.clientConfig, + value: attributes.clientConfig + ) + let identity = try await identityResolver.getIdentity( + identityProperties: modifiedIdentityProperties + ) // Save selected auth scheme selectedAuthScheme = SelectedAuthScheme( schemeID: option.schemeID, From 81f95eb312657ba81f30905bf09e30c19ba8963f Mon Sep 17 00:00:00 2001 From: Josh Elkins Date: Thu, 5 Jun 2025 10:50:15 -0500 Subject: [PATCH 4/8] Mod auth scheme for rules-based signing name --- Sources/ClientRuntime/Config/ClientConfiguration.swift | 2 +- Sources/SmithyHTTPAuth/SigV4AuthScheme.swift | 5 +++-- .../swift/codegen/middleware/MiddlewareExecutionGenerator.kt | 1 - 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Sources/ClientRuntime/Config/ClientConfiguration.swift b/Sources/ClientRuntime/Config/ClientConfiguration.swift index 8b76fe7c5..f0a4129d7 100644 --- a/Sources/ClientRuntime/Config/ClientConfiguration.swift +++ b/Sources/ClientRuntime/Config/ClientConfiguration.swift @@ -5,6 +5,6 @@ // SPDX-License-Identifier: Apache-2.0 // -public protocol ClientConfiguration { +public protocol ClientConfiguration: Sendable { init() async throws } diff --git a/Sources/SmithyHTTPAuth/SigV4AuthScheme.swift b/Sources/SmithyHTTPAuth/SigV4AuthScheme.swift index c5a098370..62b4fb441 100644 --- a/Sources/SmithyHTTPAuth/SigV4AuthScheme.swift +++ b/Sources/SmithyHTTPAuth/SigV4AuthScheme.swift @@ -34,8 +34,9 @@ public struct SigV4AuthScheme: AuthScheme { value: context.isBidirectionalStreamingEnabled ) - // Set signing name and signing region flags - updatedSigningProperties.set(key: SigningPropertyKeys.signingName, value: context.signingName) + // Set resolved signing name and signing region flags + let signingName = updatedSigningProperties.get(key: SigningPropertyKeys.signingName) ?? context.signingName + updatedSigningProperties.set(key: SigningPropertyKeys.signingName, value: signingName) updatedSigningProperties.set(key: SigningPropertyKeys.signingRegion, value: context.signingRegion) // Set expiration flag diff --git a/smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/middleware/MiddlewareExecutionGenerator.kt b/smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/middleware/MiddlewareExecutionGenerator.kt index 06d10a608..6d9fa165a 100644 --- a/smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/middleware/MiddlewareExecutionGenerator.kt +++ b/smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/middleware/MiddlewareExecutionGenerator.kt @@ -91,7 +91,6 @@ class MiddlewareExecutionGenerator( // FIXME it over indents if i add another indent, come up with better way to properly indent or format for swift - writer.write(" .withClientConfig(value: config)") writer.write(" .withMethod(value: .\$L)", httpMethod) writer.write(" .withServiceName(value: serviceName)") writer.write(" .withOperation(value: \$S)", op.toLowerCamelCase()) From d6bd2bda83b3d9f697b955108d9501bc4203f91b Mon Sep 17 00:00:00 2001 From: Josh Elkins Date: Thu, 5 Jun 2025 15:25:27 -0500 Subject: [PATCH 5/8] Fix codegen tests --- .../smithy/swift/codegen/HttpProtocolClientGeneratorTests.kt | 2 -- .../smithy/swift/codegen/requestandresponse/EventStreamTests.kt | 1 - 2 files changed, 3 deletions(-) diff --git a/smithy-swift-codegen/src/test/kotlin/software/amazon/smithy/swift/codegen/HttpProtocolClientGeneratorTests.kt b/smithy-swift-codegen/src/test/kotlin/software/amazon/smithy/swift/codegen/HttpProtocolClientGeneratorTests.kt index 57f725f68..2ace6c4f3 100644 --- a/smithy-swift-codegen/src/test/kotlin/software/amazon/smithy/swift/codegen/HttpProtocolClientGeneratorTests.kt +++ b/smithy-swift-codegen/src/test/kotlin/software/amazon/smithy/swift/codegen/HttpProtocolClientGeneratorTests.kt @@ -158,7 +158,6 @@ extension RestJsonProtocolClient { contents.shouldSyntacticSanityCheck() val expectedFragment = """ let context = Smithy.ContextBuilder() - .withClientConfig(value: config) .withMethod(value: .post) .withServiceName(value: serviceName) .withOperation(value: "getStatus") @@ -191,7 +190,6 @@ extension RestJsonProtocolClient { val expected = """ public func allocateWidget(input: AllocateWidgetInput) async throws -> AllocateWidgetOutput { let context = Smithy.ContextBuilder() - .withClientConfig(value: config) .withMethod(value: .post) .withServiceName(value: serviceName) .withOperation(value: "allocateWidget") diff --git a/smithy-swift-codegen/src/test/kotlin/software/amazon/smithy/swift/codegen/requestandresponse/EventStreamTests.kt b/smithy-swift-codegen/src/test/kotlin/software/amazon/smithy/swift/codegen/requestandresponse/EventStreamTests.kt index 65430919c..d5869388d 100644 --- a/smithy-swift-codegen/src/test/kotlin/software/amazon/smithy/swift/codegen/requestandresponse/EventStreamTests.kt +++ b/smithy-swift-codegen/src/test/kotlin/software/amazon/smithy/swift/codegen/requestandresponse/EventStreamTests.kt @@ -213,7 +213,6 @@ extension EventStreamTestClientTypes.TestStream { val expected = """ public func testStreamOp(input: TestStreamOpInput) async throws -> TestStreamOpOutput { let context = Smithy.ContextBuilder() - .withClientConfig(value: config) .withMethod(value: .post) .withServiceName(value: serviceName) .withOperation(value: "testStreamOp") From 6cdaf0e80bfac439fcebddace8d0f8bbb434560d Mon Sep 17 00:00:00 2001 From: Josh Elkins Date: Tue, 10 Jun 2025 18:54:30 -0500 Subject: [PATCH 6/8] Remove Sendable from ClientConfiguration --- Sources/ClientRuntime/Config/ClientConfiguration.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/ClientRuntime/Config/ClientConfiguration.swift b/Sources/ClientRuntime/Config/ClientConfiguration.swift index f0a4129d7..8b76fe7c5 100644 --- a/Sources/ClientRuntime/Config/ClientConfiguration.swift +++ b/Sources/ClientRuntime/Config/ClientConfiguration.swift @@ -5,6 +5,6 @@ // SPDX-License-Identifier: Apache-2.0 // -public protocol ClientConfiguration: Sendable { +public protocol ClientConfiguration { init() async throws } From 3cd687dca3a84b558c1cbd09bbd75ea546424c6f Mon Sep 17 00:00:00 2001 From: Josh Elkins Date: Fri, 13 Jun 2025 15:56:09 -0500 Subject: [PATCH 7/8] Fix Swift6 issue with client config --- .../ClientRuntime/Config/Context+Config.swift | 30 +++++++++++++++---- .../Config/IdentityPropertyKeys.swift | 4 ++- .../Middlewares/AuthSchemeMiddleware.swift | 4 +-- 3 files changed, 30 insertions(+), 8 deletions(-) diff --git a/Sources/ClientRuntime/Config/Context+Config.swift b/Sources/ClientRuntime/Config/Context+Config.swift index 6bce8c8a6..7dc98f38d 100644 --- a/Sources/ClientRuntime/Config/Context+Config.swift +++ b/Sources/ClientRuntime/Config/Context+Config.swift @@ -12,18 +12,38 @@ import struct Smithy.AttributeKey public extension Context { var clientConfig: DefaultClientConfiguration? { - get { get(key: clientConfigKey) } - set { set(key: clientConfigKey, value: newValue) } + get { get(key: clientConfigKey)?.clientConfig } + set { set(key: clientConfigKey, value: ClientConfigurationWrapper(clientConfig: newValue)) } } } public extension ContextBuilder { func withClientConfig(value: DefaultClientConfiguration?) -> Self { - attributes.set(key: clientConfigKey, value: value) + let wrapped = ClientConfigurationWrapper(clientConfig: value) + attributes.set(key: clientConfigKey, value: wrapped) return self } } -private let clientConfigKey: AttributeKey = - AttributeKey(name: "SmithySwiftClientConfig") +private let clientConfigKey = AttributeKey(name: "SmithySwiftClientConfigWrapper") + +/// A wrapper used to allow a client configuration object to be placed in Context, since client config is not Sendable. +/// +/// Placing the client config into Context is safe because the client config is not modified after being placed into Context. +/// Client config is unwrapped, then may be used to create a service client and make calls as part of performing an operation. +/// +/// This type is public so that it may be accessed in other runtime modules. It is protected as SPI because it is a cross-module +/// implementation detail that does not affect customers. +/// +/// `@unchecked Sendable` is used to make the wrapper Sendable even though it is technically not, due to the non-Sendable +/// client config stored within. +@_spi(ClientConfigWrapper) +public final class ClientConfigurationWrapper: @unchecked Sendable { + public let clientConfig: DefaultClientConfiguration + + init?(clientConfig: DefaultClientConfiguration?) { + guard let clientConfig else { return nil } + self.clientConfig = clientConfig + } +} diff --git a/Sources/ClientRuntime/Config/IdentityPropertyKeys.swift b/Sources/ClientRuntime/Config/IdentityPropertyKeys.swift index acf2f491c..325ce06bc 100644 --- a/Sources/ClientRuntime/Config/IdentityPropertyKeys.swift +++ b/Sources/ClientRuntime/Config/IdentityPropertyKeys.swift @@ -13,5 +13,7 @@ public enum IdentityPropertyKeys { /// /// Used only in conjunction with the `awsv4-s3express` auth scheme, which generates bucket-specific credentials /// for use with the S3 Express service. - public static let clientConfig = AttributeKey(name: "ClientRuntimeClientConfig") + @_spi(ClientConfigWrapper) + public static let clientConfigWrapper = + AttributeKey(name: "ClientConfigurationWrapperIdentityKey") } diff --git a/Sources/ClientRuntime/Networking/Http/Middlewares/AuthSchemeMiddleware.swift b/Sources/ClientRuntime/Networking/Http/Middlewares/AuthSchemeMiddleware.swift index 15f3eba75..99758ddf3 100644 --- a/Sources/ClientRuntime/Networking/Http/Middlewares/AuthSchemeMiddleware.swift +++ b/Sources/ClientRuntime/Networking/Http/Middlewares/AuthSchemeMiddleware.swift @@ -75,8 +75,8 @@ extension AuthSchemeMiddleware: SelectAuthScheme { // Resolve identity using the resolver from auth scheme var modifiedIdentityProperties = option.identityProperties modifiedIdentityProperties.set( - key: IdentityPropertyKeys.clientConfig, - value: attributes.clientConfig + key: IdentityPropertyKeys.clientConfigWrapper, + value: DefaultClientConfigurationWrapper(clientConfig: attributes.clientConfig) ) let identity = try await identityResolver.getIdentity( identityProperties: modifiedIdentityProperties From f3351f1b3c1cab27c3d8b8003f2b28d8490d1b5d Mon Sep 17 00:00:00 2001 From: Josh Elkins Date: Fri, 13 Jun 2025 16:08:01 -0500 Subject: [PATCH 8/8] Correct build failure --- .../Networking/Http/Middlewares/AuthSchemeMiddleware.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/ClientRuntime/Networking/Http/Middlewares/AuthSchemeMiddleware.swift b/Sources/ClientRuntime/Networking/Http/Middlewares/AuthSchemeMiddleware.swift index 99758ddf3..34ac08c89 100644 --- a/Sources/ClientRuntime/Networking/Http/Middlewares/AuthSchemeMiddleware.swift +++ b/Sources/ClientRuntime/Networking/Http/Middlewares/AuthSchemeMiddleware.swift @@ -76,7 +76,7 @@ extension AuthSchemeMiddleware: SelectAuthScheme { var modifiedIdentityProperties = option.identityProperties modifiedIdentityProperties.set( key: IdentityPropertyKeys.clientConfigWrapper, - value: DefaultClientConfigurationWrapper(clientConfig: attributes.clientConfig) + value: ClientConfigurationWrapper(clientConfig: attributes.clientConfig) ) let identity = try await identityResolver.getIdentity( identityProperties: modifiedIdentityProperties