Notes2/user.go
Magnus Åhall bd4a475923 wip
2024-11-28 18:11:14 +01:00

25 lines
382 B
Go

package main
import (
// External
"github.com/golang-jwt/jwt/v5"
)
type User struct {
ID int
Username string
Password string
Name string
}
func NewUser(claims jwt.MapClaims) (u User) {
uid, _ := claims["uid"].(float64)
name, _ := claims["name"].(string)
username, _ := claims["login"].(string)
u.ID = int(uid)
u.Username = username
u.Name = name
return
}