From 30c7e578294580d5b8073fba9a249293928d7710 Mon Sep 17 00:00:00 2001 From: Peter Sanchez Date: Thu, 1 Jun 2023 18:33:50 -0600 Subject: [PATCH] Adding personal type to personal access tokens --- bearer.go | 14 ++++++++++++-- routes.go | 3 ++- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/bearer.go b/bearer.go index 98bcff5..9422516 100644 --- a/bearer.go +++ b/bearer.go @@ -12,8 +12,18 @@ import ( "hg.code.netlandish.com/~netlandish/gobwebs/crypto" ) -// TokenVersion ... -const TokenVersion uint = 0 +const ( + // TokenVersion ... + TokenVersion uint = 0 + + // Token types + + // TypePersonal ... + TypePersonal string = "PERSONAL" + + // TypeOAuth2 ... + TypeOAuth2 string = "OAUTH2" +) // Timestamp ... type Timestamp int64 diff --git a/routes.go b/routes.go index 7636e64..39ac45c 100644 --- a/routes.go +++ b/routes.go @@ -96,6 +96,7 @@ func (s *Service) AddPersonal(c echo.Context) error { grant := BearerToken{ Version: TokenVersion, + Type: TypePersonal, Issued: ToTimestamp(issued), Expires: ToTimestamp(expires), Grants: "", @@ -575,7 +576,7 @@ func (s *Service) AccessTokenPOST(c echo.Context) error { bt := BearerToken{ Version: TokenVersion, - Type: "OAUTH2", + Type: TypeOAuth2, Issued: ToTimestamp(issued), Expires: ToTimestamp(expires), Grants: payload.Grants, -- 2.45.2