mirror of
https://github.com/gravitl/netmaker.git
synced 2025-10-16 13:51:42 +08:00
switch to jwt.RegisterdClaims
This commit is contained in:
@@ -37,11 +37,11 @@ func CreateJWT(uuid string, macAddress string, network string) (response string,
|
||||
ID: uuid,
|
||||
Network: network,
|
||||
MacAddress: macAddress,
|
||||
StandardClaims: jwt.StandardClaims{
|
||||
RegisteredClaims: jwt.RegisteredClaims{
|
||||
Issuer: "Netmaker",
|
||||
Subject: fmt.Sprintf("node|%s", uuid),
|
||||
IssuedAt: time.Now().Unix(),
|
||||
ExpiresAt: expirationTime.Unix(),
|
||||
IssuedAt: jwt.NewNumericDate(time.Now()),
|
||||
ExpiresAt: jwt.NewNumericDate(expirationTime),
|
||||
},
|
||||
}
|
||||
|
||||
@@ -60,11 +60,11 @@ func CreateUserJWT(username string, networks []string, isadmin bool) (response s
|
||||
UserName: username,
|
||||
Networks: networks,
|
||||
IsAdmin: isadmin,
|
||||
StandardClaims: jwt.StandardClaims{
|
||||
RegisteredClaims: jwt.RegisteredClaims{
|
||||
Issuer: "Netmaker",
|
||||
IssuedAt: time.Now().Unix(),
|
||||
Subject: fmt.Sprintf("user|%s", username),
|
||||
ExpiresAt: expirationTime.Unix(),
|
||||
IssuedAt: jwt.NewNumericDate(time.Now()),
|
||||
ExpiresAt: jwt.NewNumericDate(expirationTime),
|
||||
},
|
||||
}
|
||||
|
||||
|
@@ -41,7 +41,7 @@ type UserClaims struct {
|
||||
IsAdmin bool
|
||||
UserName string
|
||||
Networks []string
|
||||
jwt.StandardClaims
|
||||
jwt.RegisteredClaims
|
||||
}
|
||||
|
||||
// SuccessfulUserLoginResponse - successlogin struct
|
||||
@@ -56,7 +56,7 @@ type Claims struct {
|
||||
ID string
|
||||
MacAddress string
|
||||
Network string
|
||||
jwt.StandardClaims
|
||||
jwt.RegisteredClaims
|
||||
}
|
||||
|
||||
// SuccessfulLoginResponse is struct to send the request response
|
||||
|
Reference in New Issue
Block a user