Add AWS Sigv4 authentication with credential providers and LocalStack integration tests#288
Add AWS Sigv4 authentication with credential providers and LocalStack integration tests#288
Conversation
|
|
- Added AWSAuth() and AWSSessionToken() methods to Client - Created AWS Sigv4 middleware using aws-sdk-go-v2/aws/signer/v4 - Updated AuthConfig to support AWS credentials - Added comprehensive tests for AWS auth configuration - Updated package documentation to mention AWS Sigv4 support - Dependencies: +2 (aws-sdk-go-v2 v1.41.1, smithy-go v1.24.0) Co-authored-by: moshloop <1489660+moshloop@users.noreply.github.com>
Co-authored-by: moshloop <1489660+moshloop@users.noreply.github.com>
|
@copilot Add integration test with with localstack + test various credential lookups + profiles / roles |
- Added support for AWS credential providers (environment, config files, profiles, IAM roles) - Created AWSAuthWithCredentialsProvider() method for dynamic credential lookup - Added AWSEndpoint() method for custom endpoints (LocalStack support) - Created comprehensive integration tests with LocalStack - Added tests for various credential lookup methods - Included docker-compose.yml for LocalStack setup - Added test documentation in testdata/README.md - Dependencies: Added aws-sdk-go-v2/config and credentials packages Co-authored-by: moshloop <1489660+moshloop@users.noreply.github.com>
Added comprehensive LocalStack integration tests and credential provider support in commit 1159005. Features added:
New methods:
Running integration tests: Note: Dependency count increased from 104 to 123 (+19) due to AWS config/credentials packages required for credential provider support. |
Co-authored-by: moshloop <1489660+moshloop@users.noreply.github.com>
|
@copilot fix lint errors and switch to testing with aws sts get-caller-identity |
- Fixed formatting issues (already compliant with gofmt) - Replaced S3 integration tests with STS GetCallerIdentity tests - Updated LocalStack docker-compose to only start STS service - Updated test documentation to reflect STS usage - Removed S3 SDK dependency (reduced from 123 to 118 dependencies) - STS GetCallerIdentity is simpler, faster, and requires no resource cleanup Co-authored-by: moshloop <1489660+moshloop@users.noreply.github.com>
Fixed lint errors and switched to STS GetCallerIdentity tests in commit b1fff44. Changes made:
Why STS GetCallerIdentity?
All tests passing including:
|
Adds AWS Signature Version 4 authentication for http.Client to enable requests to AWS services (S3, API Gateway, Lambda, etc.) with comprehensive credential provider support and LocalStack integration testing.
Implementation
AWSAuth()- Static credentialsAWSSessionToken()- Temporary credentials supportAWSAuthWithCredentialsProvider()- Dynamic credential lookup from environment, config files, profiles, IAM rolesAWSEndpoint()- Custom endpoints for LocalStack and AWS-compatible servicesmiddlewares/aws_sigv4.gousinggithub.com/aws/aws-sdk-go-v2/aws/signer/v4for request signing with support for both static credentials and credential providersCredential Provider Support
The implementation supports AWS credential lookup from:
AWS_ACCESS_KEY_ID,AWS_SECRET_ACCESS_KEY,AWS_REGION)~/.aws/config,~/.aws/credentials)Integration Testing
docker-compose.ymlinhttp/testdata/for easy LocalStack setuphttp/testdata/README.mdDependency Impact
github.com/aws/aws-sdk-go-v2v1.41.1,github.com/aws/smithy-gov1.24.0aws-sdk-go-v2/configv1.32.9,aws-sdk-go-v2/credentialsv1.19.9aws-sdk-go-v2/service/stsv1.41.6 and related packagesUsage
Running Integration Tests
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.