-
Notifications
You must be signed in to change notification settings - Fork 103
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
Add httpAuthSchemeMiddleware
to select an auth scheme
#929
Conversation
bf62a56
to
62e52ec
Compare
36b9869
to
98ac040
Compare
7333963
to
2300662
Compare
2300662
to
d521c11
Compare
`memoizeIdentityProvider()` is based off of `memoize()` in `@smithy/property-provider`. `isIdentityExpired()` and `doesIdentityRequireRefresh()` is based on both `normalizeTokenProvider()` and `normalizeCredentialProvider()`.
…ig` to accept `undefined`
…select an auth scheme
…emeParametersProvider`
d521c11
to
396e4f9
Compare
@@ -310,42 +305,10 @@ private void generateClientDefaults() { | |||
+ "trait of an operation."); | |||
writer.write("disableHostPrefix?: boolean;\n"); | |||
|
|||
// feat(experimentalIdentityAndAuth): write httpAuthSchemes and httpAuthSchemeProvider into ClientDefaults |
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.
This is moved into AddHttpAuthSchemeMiddleware::addConfigInterfaceFields()
// feat(experimentalIdentityAndAuth): write any HttpAuthScheme config fields into ClientDefaults | ||
// WARNING: may be changed later in lieu of {@link TypeScriptIntegration#addConfigInterfaceFields()}, | ||
// but will depend after HttpAuthScheme integration implementations. | ||
if (settings.getExperimentalIdentityAndAuth()) { |
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.
This is moved into AddHttpAuthSchemeMiddleware::customize()
where the following interfaces and function are generated:
HttpAuthSchemeInputConfig
HttpAuthSchemeResolvedConfig
resolveHttpAuthSchemeConfig
/** | ||
* @internal | ||
*/ | ||
export const memoizeIdentityProvider = <IdentityT extends Identity>( |
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.
This is based on memoize()
in @smithy/property-provider
, except:
- it also handles
undefined
values. - passes in
options
fromMemoizedIdentityProvider
to each call of the initial supplied provider.
…emeParametersProvider`
396e4f9
to
3f6c922
Compare
… and refactor `ConfigField` codegen Codegen `httpAuthSchemeMiddleware`, and also generate `resolveHttpAuthSchemeConfig` and input / resolved config interfaces. `resolveHttpAuthSchemeConfig` normalizes `ConfigField` values, and for the "main" `ConfigField`s, the property is mapped in `DefaultIdentityProviderConfig`. `ConfigField` codegen is removed from `ServiceBareBonesClientGenerator` and is moved to `AddHttpAuthSchemeMiddleware::addConfigInterfaceFields()`.
3f6c922
to
2a56477
Compare
Issue #, if available:
N/A.
Description of changes:
Dependent on: #948, #949
This PR has changes to codegen
httpAuthSchemeMiddleware
.memoizeIdentityProvider()
for normalizing and memoizing config identity propertiesDefaultIdentityProviderConfig
to acceptundefined
propertieshttpAuthSchemeMiddleware
implementation to select an auth schemeHttpAuthSchemeParametersProvider
httpAuthSchemeMiddleware
and refactorConfigField
codegenhttpAuthSchemeMiddleware
, and also generateresolveHttpAuthSchemeConfig
and input / resolved config interfaces.resolveHttpAuthSchemeConfig
normalizesConfigField
values, and for the "main"ConfigField
s, the property is mapped inDefaultIdentityProviderConfig
.ConfigField
codegen is removed fromServiceBareBonesClientGenerator
and is moved toAddHttpAuthSchemeMiddleware::addConfigInterfaceFields()
.Testing:
Note: all changes are gated by the
experimentalIdentityAndAuth
flagThe codegen diff is as follows:
If one or more of the packages in the
/packages
directory has been modified, be sureyarn changeset add
has been run and its output hasbeen committed and included in this pull request. See CONTRIBUTING.md.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.