Repository navigation
Conversation
5f014ce to
2bc68d3
Compare
2bc68d3 to
186071e
Compare
…resolver when a token is configured, otherwise to the default token identity chain
…pe, not only AWS credentials
…across config copies
… consults the token identity chain
186071e to
9f13c7a
Compare
# Conflicts: # scripts/api-snapshot/mirrors.txt # scripts/verifications/import-cost.json
There was a problem hiding this comment.
It would be useful to see what gets generated when we add new features. Can you see if you can add httpBearerAuth to the features-client model and then regenerate it? The pagination work recently updated it to show what gets generated in #979.
There was a problem hiding this comment.
Thanks. Done in 76e6e93: added @httpBearerAuth to the features-client model. Since codegen-output-py comes from the Python client generator, this PR now also adds bearer auth there (the token / token_identity_resolver config fields, the scheme, and the same _post_setup token chain the Java codegen emits), so the snapshot shows the real output.
| return | ||
| This step registers no resolvers; it only makes the shared config and the | ||
| active profile name available to the profile-based providers that follow it, | ||
| whatever identity type the chain resolves (for example ``TokenIdentity`` |
There was a problem hiding this comment.
nit: last two lines repeat the same info that this works for all identity types from the main line. lets trim it down.
| CREDENTIALS_STS_ASSUME_ROLE_WEB_ID = "k" | ||
| CREDENTIALS_PROFILE = "n" | ||
| CREDENTIALS_PROFILE_STS_WEB_ID_TOKEN = "q" # noqa: S105 | ||
| CREDENTIALS_PROFILE_SSO = "r" |
There was a problem hiding this comment.
Do we need to add BEARER_SERVICE_ENV_VARS? Or is that a separate feature?
There was a problem hiding this comment.
It is a separate feature. BEARER_SERVICE_ENV_VARS is emitted when the token comes from the AWS_BEARER_TOKEN_BEDROCK environment variable, which is out of scope for this PR.
Generated clients can now authenticate with a bearer token. For a service that models
smithy.api#httpBearerAuth:tokenandtoken_identity_resolver;Authorization: Bearer <token>header;tokennortoken_identity_resolverresolves the token through a default identity chain (the SSO token provider that joins the chain will be added in aws-sdk-python repo).Auth scheme selection is unchanged: a service that lists SigV4 before bearer auth keeps signing with SigV4 unless an
auth_scheme_resolverselects bearer auth. Both code generators (the Java codegen undercodegen/and the Python client generator inpackages/smithy-python) emit the same config fields, scheme and_post_setupwiring.Changes by package
HTTPBearerAuthTrait, the runtime representation ofsmithy.api#httpBearerAuth, alongside existingHTTPAPIKeyAuthTrait.TokenIdentity,StaticTokenResolver/AsyncStaticTokenResolver,BearerAuthScheme/AsyncBearerAuthScheme, andBearerSigner, next to the API key equivalents.TokenIdentityas well as credentials. ChangesAwsConfigto treattoken/api_keyas secrets like the access key fields, and adds_SHARED_FIELDSso deep copies share identity resolvers. Adds SSO feature IDsrands; the legacy IDs (t,u) are not added because new SDKs should not support legacy SSO profiles (nosso_session) as per the spec, as in the Ruby v4 SDK.token/token_identity_resolverwith static fakes on AWS configs that have them, so a mocked AWS bearer client never builds the real chain.HttpBearerAuthintegration that registers the scheme and the two config properties for services with@httpBearerAuth; non-AWS clients default to a static resolver (same shape as API key auth).AwsIdentityIntegrationso_post_setupwirestoken_identity_resolverthe way it already wiresaws_credentials_identity_resolver(see table), and so generated configs extend_SHARED_FIELDS. The integration applies only to AWS services (aws.api#service) with SigV4 or bearer auth; a non-AWS service with@httpBearerAuthkeeps the core generator's static resolver, since the chains read an AWS config's profile and region.@httpBearerAuthregisters the scheme and the two config properties, and anAwsIdentityIntegration(replacing the SigV4-only one) emits the same_post_setupwiring and_SHARED_FIELDSfor AWS services. Regenerates the committedcodegen-output-pysnapshots, with@httpBearerAuthadded to thefeatures-clientmodel, and documents the integration indesigns/codegen/client.md.@httpBearerAuthclienttoken_identity_resolverafter setuptoken_identity_resolver=...token="..."StaticTokenResolverTesting
Adds unit tests for the new trait, identity, resolvers, scheme, signer and chain changes; smithy-test functional tests for the mock (sync and async); and Java and Python codegen tests for the generated bearer config and
_post_setupwiring. Ranmake test-unit,make build-java,make test-integrationandmake static-analysis; CI also passes.Also generated the bedrock (SigV4 + bearer) and sqs (SigV4 only) clients with both generators and ran them against the live services, sync and async. SigV4 works as before with env credentials, static keys and a shared-config profile. On bedrock,
token=or an explicittoken_identity_resolversendsAuthorization: Bearerand succeeds with a short-term Bedrock API key; with neither set, the client builds the token chain, which fails until a token provider is installed and succeeds once one is. The sqs config has no bearer fields.Adds changelog fragments for smithy-core, smithy-http, smithy-aws-core, smithy-test and smithy-python, and a codegen entry under
## UnreleasedinCHANGELOG.md.Follow-ups (separate PRs)
_post_setupwiring.aws-credentials-sso) that joins the token identity chain.auth_scheme_preference(envAWS_AUTH_SCHEME_PREFERENCE/ profileauth_scheme_preference) to the AWS config and the generated auth scheme resolver, so a user can put bearer auth ahead of SigV4 without writing anauth_scheme_resolver.By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.