Add configurable token expiry to DSQL#4352
Open
amaksimo wants to merge 3 commits intoaws:developmentfrom
Open
Conversation
Other AWS SDKs (Go, Java, Ruby) allow configuring the auth token expiry duration up to 7 days. Add the same capability to the .NET SDK with a default of 15 minutes for backwards compatibility.
Contributor
There was a problem hiding this comment.
Pull request overview
Adds configurable expiry support to DSQL IAM auth token generation to align with other AWS SDKs, while keeping the existing 15-minute default for backward compatibility.
Changes:
- Added new DSQL auth token generator overloads that accept an
expiresInTimeSpanand validate the allowed range. - Updated token generation to emit
X-Amz-Expiresbased on the requested expiry. - Expanded unit tests to cover custom expiry and basic validation scenarios.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| sdk/src/Services/DSQL/Custom/Util/DSQLAuthTokenGenerator.cs | Adds expiresIn overloads, enforces range checks, and uses the provided expiry when building the presigned token. |
| sdk/test/Services/DSQL/UnitTests/Custom/DSQLAuthTokenGeneratorTest.cs | Adds tests for custom expiry and invalid expiry inputs; updates assertions to parameterize expected X-Amz-Expires. |
dscpinheiro
reviewed
Mar 16, 2026
sdk/test/Services/DSQL/UnitTests/Custom/DSQLAuthTokenGeneratorTest.cs
Outdated
Show resolved
Hide resolved
Cast expiresIn to int before serializing to X-Amz-Expires to ensure whole-second values. Remove unnecessary #if ASYNC_AWAIT guards from new test methods. Add DevConfig file for changelog generation.
Add TimeSpan expiresIn parameter to all convenience overloads (hostname-only, region+hostname, credentials +hostname) for both sync and async, DbConnect and DbConnectAdmin. Each delegates to the full overload.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
TimeSpan expiresInparameter to DSQL auth token generation methodsexpiresInis between 0 (exclusive) and 7 days (inclusive)Test plan