updated PAT struct to only use user id instead of user

This commit is contained in:
Pascal Fischer 2023-03-03 16:37:39 +01:00
parent b3f339c753
commit 2f2d45de9e
2 changed files with 3 additions and 3 deletions

View File

@ -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{

View File

@ -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)
}