dgrijalva / jwt-go

ARCHIVE - Golang implementation of JSON Web Tokens (JWT). This project is now maintained at:
https://github.com/golang-jwt/jwt
MIT License
10.78k stars 997 forks source link

Add a ParserOption to specify nowFunc #472

Open genkami opened 3 years ago

genkami commented 3 years ago

There is no way to set ValidationHelper.nowFunc although jwt-go provides an internal way to override time.Now by setting nowFunc. So I added a new ParserOption WithTimeFunc to utilize the feature of nowFunc.

The name WithTimeFunc is taken after TimeFunc global variable in order to give consistency to the name of exported functions and variables.