Skip to content

Commit 9532368

Browse files
committed
Verify JWT with operator token
1 parent 6a2b2ec commit 9532368

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

api/auth.go

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,16 +35,13 @@ func (a *API) extractBearerToken(w http.ResponseWriter, r *http.Request) (string
3535
}
3636

3737
func (a *API) parseJWTClaims(bearer string, r *http.Request) (context.Context, error) {
38-
ctx := r.Context()
39-
config := getConfig(ctx)
40-
4138
p := jwt.Parser{ValidMethods: []string{jwt.SigningMethodHS256.Name}}
4239
token, err := p.ParseWithClaims(bearer, &GatewayClaims{}, func(token *jwt.Token) (interface{}, error) {
43-
return []byte(config.JWT.Secret), nil
40+
return []byte(a.config.OperatorToken), nil
4441
})
4542
if err != nil {
4643
return nil, unauthorizedError("Invalid token: %v", err)
4744
}
4845

49-
return withToken(ctx, token), nil
46+
return withToken(r.Context(), token), nil
5047
}

0 commit comments

Comments
 (0)