This commit is contained in:
@@ -6,17 +6,19 @@ import (
|
||||
"fmt"
|
||||
"gitee.ltd/lxh/logger/log"
|
||||
"github.com/golang-jwt/jwt/v5"
|
||||
"github.com/google/uuid"
|
||||
"strings"
|
||||
"time"
|
||||
"wireguard-dashboard/client"
|
||||
"wireguard-dashboard/config"
|
||||
"wireguard-dashboard/constant"
|
||||
)
|
||||
|
||||
const Secret = "IK8MSs76Pb2VJxleTDadf1Wzu3h9QROLv0XtmnCUErYgBG5wAyjk4cioqFZHNpZG"
|
||||
|
||||
type JwtClaims struct {
|
||||
ID string `json:"id"`
|
||||
jwt.RegisteredClaims `json:"-"`
|
||||
ID string `json:"id"`
|
||||
jwt.RegisteredClaims
|
||||
}
|
||||
|
||||
func JWT() JwtClaims {
|
||||
@@ -36,10 +38,12 @@ func (j JwtClaims) GenerateToken(userId string) (token string, expireTime *jwt.N
|
||||
claims := JwtClaims{
|
||||
ID: userId,
|
||||
RegisteredClaims: jwt.RegisteredClaims{
|
||||
Subject: "wireguard-dashboard",
|
||||
Issuer: config.Config.Http.Endpoint, // 颁发站点
|
||||
Subject: "wg-dashboard",
|
||||
ExpiresAt: expireTime,
|
||||
NotBefore: notBefore,
|
||||
IssuedAt: issuedAt,
|
||||
ID: uuid.NewString(),
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user