Skip to content

Commit e4059fc

Browse files
authored
chore: v1.5-main merge (#1323)
1 parent cec880a commit e4059fc

File tree

8 files changed

+85
-4
lines changed

8 files changed

+85
-4
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog
22

3+
## [1.4.23] - 07/15/2025
4+
5+
## [1.4.22] - 07/02/2025
6+
37
## [1.4.21] - 06/27/2025
48

59
## [1.4.20] - 06/20/2025

codegen/smithy-kotlin-codegen/src/main/kotlin/software/amazon/smithy/kotlin/codegen/core/RuntimeTypes.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -380,6 +380,9 @@ object RuntimeTypes {
380380
val BearerTokenProviderConfig = symbol("BearerTokenProviderConfig")
381381
val BearerTokenProvider = symbol("BearerTokenProvider")
382382

383+
val BearerToken = symbol("BearerToken")
384+
val EnvironmentBearerTokenProvider = symbol("EnvironmentBearerTokenProvider")
385+
383386
val reprioritizeAuthOptions = symbol("reprioritizeAuthOptions")
384387
}
385388

gradle.properties

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,10 @@ kotlinx.atomicfu.enableNativeIrTransformation=false
1313
org.gradle.jvmargs=-Xmx2G -XX:MaxMetaspaceSize=1G
1414

1515
# SDK
16-
sdkVersion=1.5.0-SNAPSHOT
17-
codegenVersion=0.35.0-SNAPSHOT
16+
sdkVersion=1.4.24-SNAPSHOT
17+
18+
# codegen
19+
codegenVersion=0.34.24-SNAPSHOT
1820

1921
# FIXME Remove after Dokka 2.0 Gradle plugin is stable
2022
org.jetbrains.dokka.experimental.gradle.pluginMode=V2Enabled

gradle/libs.versions.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
kotlin-version = "2.2.0"
33
dokka-version = "2.0.0"
44

5-
aws-kotlin-repo-tools-version = "0.4.31"
5+
aws-kotlin-repo-tools-version = "0.4.32"
66

77
# libs
88
coroutines-version = "1.10.2"
@@ -13,10 +13,11 @@ okio-version = "3.15.0"
1313
otel-version = "1.45.0"
1414
slf4j-version = "2.0.16"
1515
slf4j-v1x-version = "1.7.36"
16-
crt-kotlin-version = "0.9.2"
16+
crt-kotlin-version = "0.10.0"
1717
micrometer-version = "1.14.2"
1818
binary-compatibility-validator-version = "0.18.0"
1919

20+
# codegen
2021
smithy-version = "1.60.2"
2122

2223
# testing

runtime/auth/http-auth/api/http-auth.api

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,12 @@ public final class aws/smithy/kotlin/runtime/http/auth/BearerTokenSigner : aws/s
5959
public abstract interface class aws/smithy/kotlin/runtime/http/auth/CloseableBearerTokenProvider : aws/smithy/kotlin/runtime/http/auth/BearerTokenProvider, java/io/Closeable {
6060
}
6161

62+
public final class aws/smithy/kotlin/runtime/http/auth/EnvironmentBearerTokenProvider : aws/smithy/kotlin/runtime/http/auth/BearerTokenProvider {
63+
public fun <init> (Ljava/lang/String;Laws/smithy/kotlin/runtime/util/PlatformProvider;)V
64+
public synthetic fun <init> (Ljava/lang/String;Laws/smithy/kotlin/runtime/util/PlatformProvider;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
65+
public fun resolve (Laws/smithy/kotlin/runtime/collections/Attributes;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
66+
}
67+
6268
public final class aws/smithy/kotlin/runtime/http/auth/ReprioritizeAuthOptionsKt {
6369
public static final fun reprioritizeAuthOptions (Ljava/util/List;Ljava/util/List;)Ljava/util/List;
6470
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/*
2+
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
package aws.smithy.kotlin.runtime.http.auth
6+
7+
import aws.smithy.kotlin.runtime.collections.Attributes
8+
import aws.smithy.kotlin.runtime.collections.emptyAttributes
9+
import aws.smithy.kotlin.runtime.time.Instant
10+
import aws.smithy.kotlin.runtime.util.PlatformProvider
11+
12+
/**
13+
* A [BearerTokenProvider] that extracts the bearer token from the target environment variable.
14+
*/
15+
public class EnvironmentBearerTokenProvider(
16+
private val key: String,
17+
private val platform: PlatformProvider = PlatformProvider.System,
18+
) : BearerTokenProvider {
19+
override suspend fun resolve(attributes: Attributes): BearerToken {
20+
val bearerToken = platform.getenv(key)
21+
?: error("$key environment variable is not set")
22+
23+
return object : BearerToken {
24+
override val token: String = bearerToken
25+
override val attributes: Attributes = emptyAttributes()
26+
override val expiration: Instant? = null
27+
}
28+
}
29+
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
package aws.smithy.kotlin.runtime.http.auth
2+
3+
import aws.smithy.kotlin.runtime.collections.emptyAttributes
4+
import aws.smithy.kotlin.runtime.util.TestPlatformProvider
5+
import kotlinx.coroutines.test.runTest
6+
import kotlin.test.Test
7+
import kotlin.test.assertEquals
8+
import kotlin.test.assertFailsWith
9+
10+
class EnvironmentBearerTokenProviderTest {
11+
@Test
12+
fun testResolveWithValidToken() = runTest {
13+
val provider = EnvironmentBearerTokenProvider(
14+
"TEST_TOKEN",
15+
TestPlatformProvider(mutableMapOf("TEST_TOKEN" to "test-bearer-token")),
16+
)
17+
18+
val token = provider.resolve()
19+
20+
assertEquals("test-bearer-token", token.token)
21+
}
22+
23+
@Test
24+
fun testResolveWithMissingToken() = runTest {
25+
val provider = EnvironmentBearerTokenProvider(
26+
"MISSING_TEST_TOKEN",
27+
TestPlatformProvider(mutableMapOf()),
28+
)
29+
30+
val exception = assertFailsWith<IllegalStateException> {
31+
provider.resolve(emptyAttributes())
32+
}
33+
assertEquals("MISSING_TEST_TOKEN environment variable is not set", exception.message)
34+
}
35+
}

runtime/build.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
*/
55
import aws.sdk.kotlin.gradle.dsl.configurePublishing
66
import aws.sdk.kotlin.gradle.kmp.*
7+
import org.gradle.kotlin.dsl.apply
78
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
89

910
plugins {

0 commit comments

Comments
 (0)