Skip to content

Commit 786ce03

Browse files
authored
fix: add UnsupportedSigningAlgorithmInterceptor to all sigV4a services (#1245)
1 parent 4e05ac5 commit 786ce03

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

codegen/aws-sdk-codegen/src/main/kotlin/aws/sdk/kotlin/codegen/customization/SigV4AsymmetricTraitCustomization.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import software.amazon.smithy.model.transform.ModelTransformer
2222
* NOTE: Won't add sigV4 trait (services that support sigV4A MUST support sigV4)
2323
*/
2424
class SigV4AsymmetricTraitCustomization : KotlinIntegration {
25-
// Needs to happen before the `SigV4AsymmetricAuthSchemeIntegration` & `SigV4AuthSchemeIntegration` (-50 & -50)
25+
// Needs to happen before the SigV4AsymmetricAuthSchemeIntegration & SigV4AuthSchemeIntegration
2626
override val order: Byte = -60
2727

2828
// services which support SigV4A but don't model it

codegen/aws-sdk-codegen/src/main/kotlin/aws/sdk/kotlin/codegen/customization/s3/UnsupportedSigningAlgorithmIntegration.kt

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,25 +5,28 @@
55
package aws.sdk.kotlin.codegen.customization.s3
66

77
import aws.sdk.kotlin.codegen.AwsRuntimeTypes
8+
import software.amazon.smithy.aws.traits.auth.SigV4ATrait
89
import software.amazon.smithy.kotlin.codegen.KotlinSettings
910
import software.amazon.smithy.kotlin.codegen.core.KotlinWriter
1011
import software.amazon.smithy.kotlin.codegen.integration.KotlinIntegration
1112
import software.amazon.smithy.kotlin.codegen.rendering.protocol.ProtocolGenerator
1213
import software.amazon.smithy.kotlin.codegen.rendering.protocol.ProtocolMiddleware
1314
import software.amazon.smithy.model.Model
15+
import software.amazon.smithy.model.knowledge.ServiceIndex
1416
import software.amazon.smithy.model.shapes.OperationShape
1517

1618
// FIXME: Remove this once sigV4a is supported by default AWS signer
1719
/**
18-
* Registers an interceptor for S3 to deal with the default signer not supporting sigV4a
20+
* Registers an interceptor for sigV4a services to deal with the default signer not supporting sigV4a
1921
* See: [aws.sdk.kotlin.runtime.http.interceptors.UnsupportedSigningAlgorithmInterceptor]
2022
*/
2123
class UnsupportedSigningAlgorithmIntegration : KotlinIntegration {
2224
override fun enabledForService(model: Model, settings: KotlinSettings): Boolean =
23-
when (settings.sdkId.lowercase()) {
24-
"s3", "eventbridge", "cloudfront keyvaluestore" -> true
25-
else -> false
26-
}
25+
ServiceIndex
26+
.of(model)
27+
.getAuthSchemes(settings.service)
28+
.values
29+
.any { it.javaClass == SigV4ATrait::class.java }
2730

2831
override fun customizeMiddleware(
2932
ctx: ProtocolGenerator.GenerationContext,

0 commit comments

Comments
 (0)