diff --git a/authentication/authentication_test.go b/authentication/authentication_test.go index 4acd2f8a..f19e1134 100644 --- a/authentication/authentication_test.go +++ b/authentication/authentication_test.go @@ -471,7 +471,9 @@ func TestWithClockTolerance(t *testing.T) { return } w.WriteHeader(http.StatusOK) - fmt.Fprint(w, string(b)) + if _, err := fmt.Fprint(w, string(b)); err != nil { + w.WriteHeader(http.StatusInternalServerError) + } }) s := httptest.NewTLSServer(h) t.Cleanup(func() { diff --git a/authentication/oauth_test.go b/authentication/oauth_test.go index 5fc996fb..ef0fa9b6 100644 --- a/authentication/oauth_test.go +++ b/authentication/oauth_test.go @@ -514,7 +514,9 @@ func withIDToken(t *testing.T, extras map[string]interface{}) (*Authentication, return } w.WriteHeader(http.StatusOK) - fmt.Fprint(w, string(b)) + if _, err := fmt.Fprint(w, string(b)); err != nil { + w.WriteHeader(http.StatusInternalServerError) + } }) s := httptest.NewTLSServer(h) t.Cleanup(func() { diff --git a/internal/idtokenvalidator/idtokenvalidator_test.go b/internal/idtokenvalidator/idtokenvalidator_test.go index e441db00..17958a24 100644 --- a/internal/idtokenvalidator/idtokenvalidator_test.go +++ b/internal/idtokenvalidator/idtokenvalidator_test.go @@ -134,13 +134,13 @@ func TestIDTokenValidation(t *testing.T) { token, err := builder.Build() assert.NoError(t, err) - jwt, err := jwt.Sign(token, jwt.WithKey(jwa.HS512, []byte(jwtClientSecret))) + jwtPayload, err := jwt.Sign(token, jwt.WithKey(jwa.HS512, []byte(jwtClientSecret))) assert.NoError(t, err) validator, err := New(context.Background(), jwtDomain, jwtClientSecret, jwtClientID, "HS256") assert.NoError(t, err) - err = validator.Validate(string(jwt), ValidationOptions{}) + err = validator.Validate(string(jwtPayload), ValidationOptions{}) assert.ErrorContains(t, err, "signature algorithm \"HS512\" is not supported") }) @@ -650,7 +650,9 @@ func configureSigning(t *testing.T, args jwtArgs) (jwa.SignatureAlgorithm, jwk.K return } w.WriteHeader(http.StatusOK) - fmt.Fprintf(w, `{"keys": [%s] }`, b) + if _, err := fmt.Fprintf(w, `{"keys": [%s] }`, b); err != nil { + w.WriteHeader(http.StatusInternalServerError) + } }) s := httptest.NewTLSServer(h)