appleboy / gin-jwt

JWT Middleware for Gin framework
MIT License
2.73k stars 382 forks source link

bug: fix the false alarm of verification with jwt.WithJSONNumber #305

Closed panjf2000 closed 1 year ago

panjf2000 commented 1 year ago

The current implementation doesn't handle jwt.WithJSONNumber() parse option well, if you set this option and try to parse a JWT, it always fails type conversion here:

https://github.com/appleboy/gin-jwt/blob/6b68cb3e1879fc8f8936ee7a7cbb65e40e389e66/auth_jwt.go#L430-L433

We should also take care of the type json.Number and avoid the false alarm, this is also what https://github.com/golang-jwt/jwt/blob/main/map_claims.go#L40-L56 does.

panjf2000 commented 1 year ago

cc @appleboy

panjf2000 commented 1 year ago

any comments on this? @appleboy

appleboy commented 1 year ago

LGTM @panjf2000 Thanks.

appleboy commented 1 year ago

@panjf2000 sorry for the late response.

panjf2000 commented 1 year ago

Could you set up a new release for this?