Skip to content
This repository has been archived by the owner on Aug 22, 2024. It is now read-only.

Commit

Permalink
Use uuid as a default payload for jwt (#2)
Browse files Browse the repository at this point in the history
* chore: gin-jwt/v2 only support gin v1.5.0 or below (appleboy#238)

* udpate to gin 1.6.2 (appleboy#239)

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>

* Fix documentation description of functions (appleboy#241)

* fixed readme descriptions

* fixed readme descriptions.

* chore: upgrade golang to 1.14 build

* chore: upgrade dependency

* Fix typo in README: Faliures -> Failures (appleboy#244)

* chore: upgrade gin to v1.6.3

* implements CookieMaxAge value (appleboy#245)

* docs: update comments of SigningAlgorithm field (appleboy#246)

* calculate cookie max-age using TimeFunc (appleboy#249)

* claim uuid for login and refresh

* go module

* fixes

Co-authored-by: Bo-Yi Wu <appleboy.tw@gmail.com>
Co-authored-by: karimabedrabbo <karimnabedrabbo@gmail.com>
Co-authored-by: Andy Grunwald <andygrunwald@gmail.com>
Co-authored-by: skromez <42495435+skromez@users.noreply.github.com>
Co-authored-by: Jesús Rodríguez Pérez <jesusnoseq@hotmail.com>
Co-authored-by: Jorrit Salverda <JorritSalverda@users.noreply.github.com>
  • Loading branch information
7 people authored Jul 8, 2020
1 parent de12cc1 commit e1bbff1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion _example/basic/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (
"os"
"time"

"github.com/appleboy/gin-jwt/v2"
"github.com/gin-gonic/gin"
"github.com/turingvideo/gin-jwt"
)

type login struct {
Expand Down
2 changes: 2 additions & 0 deletions auth_jwt.go
Original file line number Diff line number Diff line change
Expand Up @@ -539,6 +539,8 @@ func (mw *GinJWTMiddleware) RefreshToken(c *gin.Context) (string, time.Time, err
expire := mw.TimeFunc().Add(mw.Timeout)
newClaims["exp"] = expire.Unix()
newClaims["orig_iat"] = mw.TimeFunc().Unix()
// add uuid as a default claim
claims["uuid"] = uuid.NewV4()
tokenString, err := mw.signedString(newToken)

if err != nil {
Expand Down

0 comments on commit e1bbff1

Please sign in to comment.