Skip to content

Commit bcd3f65

Browse files
committed
ci: refine file input checks and webserver reponses
1 parent 5a56ffa commit bcd3f65

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

internal/jwtinfo/main_test.go

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,14 @@ func jwksFaultyHandler(writer http.ResponseWriter, _ *http.Request) {
144144

145145
// validJwksFile := "testdata/jwkset-from-rsa-private-key-valid.json"
146146
corruptedJwksFile := "testdata/jwkset-from-rsa-private-key-corrupted.json"
147-
jwksContent, _ := os.ReadFile(corruptedJwksFile)
147+
148+
jwksContent, err := os.ReadFile(corruptedJwksFile)
149+
if err != nil {
150+
log.Printf("failed to read corrupted JWKS file: %s", err)
151+
writer.WriteHeader(http.StatusInternalServerError)
152+
153+
return
154+
}
148155

149156
writer.Header().Set("Content-Type", "application/json")
150157
_, _ = writer.Write(jwksContent)
@@ -214,9 +221,8 @@ func authHandler(w http.ResponseWriter, r *http.Request) {
214221

215222
if scope == "appJwtInvalid" {
216223
w.Header().Set("Content-Type", "application/jwt")
217-
// w.WriteHeader(http.StatusOK)
218-
fmt.Println("JWT invalid")
219-
// _, _ = fmt.Fprintln(w, "")
224+
w.WriteHeader(http.StatusOK)
225+
_, _ = fmt.Fprintln(w, "invalid-jwt-token")
220226

221227
return
222228
}

0 commit comments

Comments
 (0)