mirror of
https://git.freecumextremist.com/grumbulon/pomme.git
synced 2024-12-22 17:40:43 +00:00
make jwt expiration consistent with cookies
This commit is contained in:
parent
002787c1fc
commit
1e5ba290c4
1 changed files with 6 additions and 1 deletions
|
@ -2,6 +2,7 @@ package api
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"git.freecumextremist.com/grumbulon/pomme/internal"
|
||||
"github.com/go-chi/jwtauth/v5"
|
||||
|
@ -16,7 +17,11 @@ func init() {
|
|||
}
|
||||
|
||||
func makeToken(username string) (tokenString string, err error) {
|
||||
if _, tokenString, err = tokenAuth.Encode(map[string]interface{}{"username": username, "admin": "false"}); err == nil {
|
||||
claim := map[string]interface{}{"username": username, "admin": false}
|
||||
|
||||
jwtauth.SetExpiry(claim, time.Now().Add(time.Hour))
|
||||
|
||||
if _, tokenString, err = tokenAuth.Encode(claim); err == nil {
|
||||
return
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue