From 1c1f78559daf9ff622d6c39011302982875c2a79 Mon Sep 17 00:00:00 2001 From: Derrick Hammer Date: Mon, 12 Feb 2024 01:01:58 -0500 Subject: [PATCH] fix: need to subclass StandardClaims to make Issuer any --- api/middleware.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/api/middleware.go b/api/middleware.go index 3207395..48b7d45 100644 --- a/api/middleware.go +++ b/api/middleware.go @@ -25,6 +25,11 @@ const WEBHOOK_CONTEXT_KEY = "webhook" const AuthCookieName = "auth-token" +type standardClaims struct { + Issuer any `json:"iss,omitempty"` + jwt.StandardClaims +} + func findAuthToken(r *http.Request) string { authHeader := parseAuthTokenHeader(r.Header) @@ -129,7 +134,7 @@ func githubRestVerifyMiddleware(db *gorm.DB) mux.MiddlewareFunc { publicKey := &privateKey.PublicKey - parseToken, err = jwt.ParseWithClaims(token, &jwt.StandardClaims{}, func(token *jwt.Token) (interface{}, error) { + parseToken, err = jwt.ParseWithClaims(token, &standardClaims{}, func(token *jwt.Token) (interface{}, error) { if _, ok := token.Method.(*jwt.SigningMethodRSA); !ok { return nil, fmt.Errorf("unexpected signing method: %v", token.Header["alg"]) }