mirror of
https://github.com/netbirdio/netbird.git
synced 2025-02-08 22:39:55 +01:00
add id to the PAT
This commit is contained in:
parent
69be2a8071
commit
e0fc779f58
@ -8,9 +8,11 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
"codeberg.org/ac/base62"
|
"codeberg.org/ac/base62"
|
||||||
|
"github.com/rs/xid"
|
||||||
)
|
)
|
||||||
|
|
||||||
type PersonalAccessToken struct {
|
type PersonalAccessToken struct {
|
||||||
|
ID string
|
||||||
Description string
|
Description string
|
||||||
HashedToken [32]byte
|
HashedToken [32]byte
|
||||||
ExpirationDate time.Time
|
ExpirationDate time.Time
|
||||||
@ -38,6 +40,7 @@ func CreateNewPAT(description string, expirationInDays int, createdBy User) (*Pe
|
|||||||
hashedToken, plainToken := generateNewToken()
|
hashedToken, plainToken := generateNewToken()
|
||||||
currentTime := time.Now().UTC()
|
currentTime := time.Now().UTC()
|
||||||
return &PersonalAccessToken{
|
return &PersonalAccessToken{
|
||||||
|
ID: xid.New().String(),
|
||||||
Description: description,
|
Description: description,
|
||||||
HashedToken: hashedToken,
|
HashedToken: hashedToken,
|
||||||
ExpirationDate: currentTime.AddDate(0, 0, expirationInDays),
|
ExpirationDate: currentTime.AddDate(0, 0, expirationInDays),
|
||||||
|
Loading…
Reference in New Issue
Block a user