moves claims into models
This commit is contained in:
parent
38722c9da5
commit
f1c2249744
6 changed files with 57 additions and 35 deletions
|
|
@ -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,
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue