This commit is contained in:
Magnus Åhall 2024-11-28 18:11:14 +01:00
parent 515c748e14
commit bd4a475923
23 changed files with 1217 additions and 192 deletions

24
user.go Normal file
View file

@ -0,0 +1,24 @@
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
}