Skip to content

Commit 896568c

Browse files
authored
Feat: add session token support for sigv4 to support auth service (#1410)
1 parent 7abb93a commit 896568c

File tree

3 files changed

+9
-0
lines changed

3 files changed

+9
-0
lines changed

backend/http_settings.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ type HTTPSettings struct {
4545
SigV4Profile string
4646
SigV4AccessKey string
4747
SigV4SecretKey string
48+
SigV4SessionToken string
4849

4950
JSONData map[string]interface{}
5051
SecureJSONData map[string]string
@@ -93,6 +94,7 @@ func (s *HTTPSettings) HTTPClientOptions() httpclient.Options {
9394
Profile: s.SigV4Profile,
9495
AccessKey: s.SigV4AccessKey,
9596
SecretKey: s.SigV4SecretKey,
97+
SessionToken: s.SigV4SessionToken,
9698
AssumeRoleARN: s.SigV4AssumeRoleARN,
9799
ExternalID: s.SigV4ExternalID,
98100
Region: s.SigV4Region,
@@ -274,6 +276,9 @@ func parseHTTPSettings(jsonData json.RawMessage, secureJSONData map[string]strin
274276
if v, exists := secureJSONData["sigV4SecretKey"]; exists {
275277
s.SigV4SecretKey = v
276278
}
279+
if v, exists := secureJSONData["sigV4SessionToken"]; exists {
280+
s.SigV4SessionToken = v
281+
}
277282
}
278283

279284
// headers

backend/http_settings_test.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ func TestParseHTTPSettings(t *testing.T) {
5555
"tlsClientKey": "tlsClientKey3",
5656
"sigV4AccessKey": "sigV4AccessKey4",
5757
"sigV4SecretKey": "sigV4SecretKey5",
58+
"sigV4SessionToken": "sigV4SessionToken6",
5859
"httpHeaderValue1": "SecretOne",
5960
"httpHeaderValue2": "SecretTwo",
6061
"httpHeaderValue3": "SecretThree",
@@ -99,6 +100,7 @@ func TestParseHTTPSettings(t *testing.T) {
99100
SigV4Profile: "ghi",
100101
SigV4AccessKey: "sigV4AccessKey4",
101102
SigV4SecretKey: "sigV4SecretKey5",
103+
SigV4SessionToken: "sigV4SessionToken6",
102104
JSONData: jsonMap,
103105
SecureJSONData: secureData,
104106
}, s)
@@ -141,6 +143,7 @@ func TestParseHTTPSettings(t *testing.T) {
141143
Profile: "ghi",
142144
AccessKey: "sigV4AccessKey4",
143145
SecretKey: "sigV4SecretKey5",
146+
SessionToken: "sigV4SessionToken6",
144147
},
145148
Labels: map[string]string{},
146149
CustomOptions: map[string]interface{}{},

backend/httpclient/options.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ type SigV4Config struct {
127127
Service string
128128
AccessKey string
129129
SecretKey string
130+
SessionToken string
130131
AssumeRoleARN string
131132
ExternalID string
132133
Region string

0 commit comments

Comments
 (0)