fix: need to subclass StandardClaims to make Issuer any

This commit is contained in:
Derrick Hammer 2024-02-12 01:01:58 -05:00
parent 608cfad501
commit 1c1f78559d
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 6 additions and 1 deletions

View File

@ -25,6 +25,11 @@ const WEBHOOK_CONTEXT_KEY = "webhook"
const AuthCookieName = "auth-token" const AuthCookieName = "auth-token"
type standardClaims struct {
Issuer any `json:"iss,omitempty"`
jwt.StandardClaims
}
func findAuthToken(r *http.Request) string { func findAuthToken(r *http.Request) string {
authHeader := parseAuthTokenHeader(r.Header) authHeader := parseAuthTokenHeader(r.Header)
@ -129,7 +134,7 @@ func githubRestVerifyMiddleware(db *gorm.DB) mux.MiddlewareFunc {
publicKey := &privateKey.PublicKey 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 { if _, ok := token.Method.(*jwt.SigningMethodRSA); !ok {
return nil, fmt.Errorf("unexpected signing method: %v", token.Header["alg"]) return nil, fmt.Errorf("unexpected signing method: %v", token.Header["alg"])
} }