-
Notifications
You must be signed in to change notification settings - Fork 33
feat: Support auth scheme preference list #934
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See inline questions/comments
/// - authSchemePreference: List of preferred auth scheme IDs | ||
/// - authOptions: List of auth options to prioritize | ||
/// - Returns: A new list of auth options with preferred options first, followed by non-preferred options | ||
public extension AuthSchemeResolver { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the reason for using normalized (i.e. without the namespace) names for comparison here? Will there ever be an auth scheme defined in two different namespaces, and if so, would we necessarily want to treat them as the same?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Its part of the SEP update -- allows users to specify sigv4 / sigv4a / etc. without needing to know which namespace its from since when loading from environment its a String whereas in code they could say [Sigv4ATrait.ID] and not worry about it
valid auth options have the fully qualified name still
/// Sets the auth scheme priority from a preference list of IDs. | ||
@discardableResult | ||
public func withAuthSchemePreference(value: [String]?) -> Self { | ||
if (value ?? []).isEmpty { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: value?.isEmpty ?? true
skips the array literal
@@ -149,6 +151,19 @@ class AuthSchemeResolverGenerator { | |||
} | |||
} | |||
|
|||
private fun renderInit(writer: SwiftWriter) { | |||
writer.apply { | |||
write("public let authSchemePreference: [String]?") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is there a reason to permit both nil
and []
as allowed values?
@@ -47,6 +47,7 @@ extension RestJsonProtocolClient { | |||
public var httpClientEngine: SmithyHTTPAPI.HTTPClient | |||
public var httpClientConfiguration: ClientRuntime.HttpClientConfiguration | |||
public var authSchemes: SmithyHTTPAuthAPI.AuthSchemes? | |||
public var authSchemePreference: [String]? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
again, should nil
and []
both be allowed here? Do they have different meanings?
Issue #
Description of changes
Scope
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.