Skip to content

Commit 1c1e062

Browse files
sichanyooSichan Yoo
andauthored
Add util function for checking if auth scheme is supported or not to AuthUtils. (#789)
Co-authored-by: Sichan Yoo <[email protected]>
1 parent f5f1fd6 commit 1c1e062

File tree

1 file changed

+5
-0
lines changed
  • smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/utils

1 file changed

+5
-0
lines changed

smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/utils/AuthUtils.kt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package software.amazon.smithy.swift.codegen.utils
22

33
import software.amazon.smithy.model.knowledge.ServiceIndex
4+
import software.amazon.smithy.model.shapes.ShapeId
45
import software.amazon.smithy.model.traits.HttpBearerAuthTrait
56
import software.amazon.smithy.swift.codegen.SwiftWriter
67
import software.amazon.smithy.swift.codegen.config.DefaultProvider
@@ -16,6 +17,10 @@ open class AuthUtils(
1617
isAsync = false
1718
)
1819

20+
fun isSupportedAuthScheme(authSchemeID: ShapeId): Boolean {
21+
return ServiceIndex(ctx.model).getEffectiveAuthSchemes(ctx.service).contains(authSchemeID)
22+
}
23+
1924
fun getModeledAuthSchemesSupportedBySDK(
2025
ctx: ProtocolGenerator.GenerationContext,
2126
writer: SwiftWriter,

0 commit comments

Comments
 (0)