mirror of
https://github.com/netbirdio/netbird.git
synced 2024-11-26 10:03:47 +01:00
updated PAT struct to only use user id instead of user
This commit is contained in:
parent
b3f339c753
commit
2f2d45de9e
@ -17,12 +17,12 @@ type PersonalAccessToken struct {
|
||||
HashedToken [32]byte
|
||||
ExpirationDate time.Time
|
||||
// scope could be added in future
|
||||
CreatedBy User // should we add that?
|
||||
CreatedBy string
|
||||
CreatedAt time.Time
|
||||
LastUsed time.Time
|
||||
}
|
||||
|
||||
func CreateNewPAT(description string, expirationInDays int, createdBy User) (*PersonalAccessToken, string) {
|
||||
func CreateNewPAT(description string, expirationInDays int, createdBy string) (*PersonalAccessToken, string) {
|
||||
hashedToken, plainToken := generateNewToken()
|
||||
currentTime := time.Now().UTC()
|
||||
return &PersonalAccessToken{
|
||||
|
@ -18,7 +18,7 @@ func TestPAT_GenerateToken_Hashing(t *testing.T) {
|
||||
|
||||
func TestPAT_GenerateToken_Prefix(t *testing.T) {
|
||||
_, plainToken := generateNewToken()
|
||||
fourLetterPrefix := plainToken[:4] // should be 3
|
||||
fourLetterPrefix := plainToken[:4]
|
||||
assert.Equal(t, "nbp_", fourLetterPrefix)
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user