moves claims into models

This commit is contained in:
dhax 2017-10-04 02:52:19 +02:00
parent 38722c9da5
commit f1c2249744
6 changed files with 57 additions and 35 deletions

View file

@ -3,6 +3,7 @@ package models
import (
"time"
"github.com/go-chi/jwtauth"
"github.com/go-pg/pg/orm"
)
@ -34,3 +35,10 @@ func (t *Token) BeforeUpdate(db orm.DB) error {
t.UpdatedAt = time.Now()
return nil
}
func (t *Token) Claims() jwtauth.Claims {
return jwtauth.Claims{
"id": t.ID,
"token": t.Token,
}
}