diff --git a/proxy/go.mod b/proxy/go.mod index e504e956a4..4d1595eb4e 100644 --- a/proxy/go.mod +++ b/proxy/go.mod @@ -9,6 +9,7 @@ require ( github.com/coreos/go-oidc v2.2.1+incompatible github.com/cs3org/go-cs3apis v0.0.0-20201007120910-416ed6cf8b00 github.com/cs3org/reva v1.3.1-0.20201023144216-cdb3d6688da5 + github.com/dgrijalva/jwt-go v3.2.0+incompatible github.com/google/uuid v1.1.2 github.com/justinas/alice v1.2.0 github.com/micro/cli/v2 v2.1.2 diff --git a/proxy/pkg/middleware/signed_url_auth_test.go b/proxy/pkg/middleware/signed_url_auth_test.go index e421ee0a1d..856fcdb0e2 100644 --- a/proxy/pkg/middleware/signed_url_auth_test.go +++ b/proxy/pkg/middleware/signed_url_auth_test.go @@ -10,13 +10,17 @@ func TestSignedURLAuth_shouldServe(t *testing.T) { pua := signedURLAuth{} tests := []struct { url string + enabled bool expected bool }{ - {"https://example.com/example.jpg", false}, - {"https://example.com/example.jpg?OC-Signature=something", true}, + {"https://example.com/example.jpg", true, false}, + {"https://example.com/example.jpg?OC-Signature=something", true, true}, + {"https://example.com/example.jpg", false, false}, + {"https://example.com/example.jpg?OC-Signature=something", false, false}, } for _, tt := range tests { + pua.preSignedURLConfig.Enabled = tt.enabled r := httptest.NewRequest("", tt.url, nil) result := pua.shouldServe(r) @@ -102,7 +106,7 @@ func TestSignedURLAuth_urlIsExpired(t *testing.T) { } tests := []struct { - url string + url string isExpired bool }{ {"http://example.com/example.jpg?OC-Date=2020-02-02T12:29:00.000Z&OC-Expires=61", false},