Auth: Use SigV4 lib from grafana-aws-sdk (#30713)

* replace with lib

* remove test + apply feedback
This commit is contained in:
Will Browne
2021-02-01 16:07:27 +01:00
committed by GitHub
parent 08eee87148
commit 3b7b49a4aa
5 changed files with 32 additions and 202 deletions
-24
View File
@@ -214,30 +214,6 @@ func TestDataSource_GetHttpTransport(t *testing.T) {
assert.Equal(t, "Ok", bodyStr)
})
t.Run("Should use SigV4 in middleware chain if configured in JsonData", func(t *testing.T) {
clearDSProxyCache(t)
origEnabled := setting.SigV4AuthEnabled
setting.SigV4AuthEnabled = true
t.Cleanup(func() { setting.SigV4AuthEnabled = origEnabled })
json, err := simplejson.NewJson([]byte(`{ "sigV4Auth": true }`))
require.NoError(t, err)
ds := DataSource{
JsonData: json,
}
tr, err := ds.GetHttpTransport()
require.NoError(t, err)
m1, ok := tr.next.(*SigV4Middleware)
require.True(t, ok)
_, ok = m1.Next.(*http.Transport)
require.True(t, ok)
})
t.Run("Should not include SigV4 middleware if not configured in JsonData", func(t *testing.T) {
clearDSProxyCache(t)