upload/aws: add support for session tokens

If a user uses a temporary access key for login, a session token is also
needed.

This commit adds support for it to the internal aws library and also
to the osbuild-upload-aws helper. Note that this doesn't affect the main
osbuild-composer executable nor the worker. Everything here should work
as before and session tokens are not supported. Something for a follow up
if anyone needs it.

Signed-off-by: Ondřej Budai <ondrej@budai.cz>
This commit is contained in:
Ondřej Budai 2021-06-25 16:22:54 +02:00 committed by Alexander Todorov
parent bb2f866470
commit 579a5df698
4 changed files with 10 additions and 6 deletions

View file

@ -21,9 +21,9 @@ type AWS struct {
s3 *s3.S3
}
func New(region, accessKeyID, accessKey string) (*AWS, error) {
func New(region, accessKeyID, accessKey, sessionToken string) (*AWS, error) {
// Session credentials
creds := credentials.NewStaticCredentials(accessKeyID, accessKey, "")
creds := credentials.NewStaticCredentials(accessKeyID, accessKey, sessionToken)
// Create a Session with a custom region
sess, err := session.NewSession(&aws.Config{