Skip to content

Commit 8855213

Browse files
committed
Verify JWT with JWT secret
1 parent 84741ca commit 8855213

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

api/middleware.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ func (a *API) loadJWSSignatureHeader(w http.ResponseWriter, r *http.Request) (co
3030

3131
func (a *API) loadInstanceConfig(w http.ResponseWriter, r *http.Request) (context.Context, error) {
3232
ctx := r.Context()
33+
config := getConfig(ctx)
3334

3435
signature := getSignature(ctx)
3536
if signature == "" {
@@ -39,7 +40,7 @@ func (a *API) loadInstanceConfig(w http.ResponseWriter, r *http.Request) (contex
3940
claims := NetlifyMicroserviceClaims{}
4041
p := jwt.Parser{ValidMethods: []string{jwt.SigningMethodHS256.Name}}
4142
_, err := p.ParseWithClaims(signature, &claims, func(token *jwt.Token) (interface{}, error) {
42-
return []byte(a.config.OperatorToken), nil
43+
return []byte(config.JWT.Secret), nil
4344
})
4445
if err != nil {
4546
return nil, badRequestError("Operator microservice signature is invalid: %v", err)

0 commit comments

Comments
 (0)