From d866d5b53b83eed2f7347cf7ed7ef22dbef1b53a Mon Sep 17 00:00:00 2001 From: Steven Date: Mon, 10 Jul 2023 21:40:55 +0800 Subject: [PATCH] chore: move auth to apiv1 --- api/v1/auth.go | 2 +- {server => api/v1}/auth/auth.go | 6 ++---- api/v1/jwt.go | 2 +- 3 files changed, 4 insertions(+), 6 deletions(-) rename {server => api/v1}/auth/auth.go (96%) diff --git a/api/v1/auth.go b/api/v1/auth.go index f588d25..b1b7461 100644 --- a/api/v1/auth.go +++ b/api/v1/auth.go @@ -5,7 +5,7 @@ import ( "fmt" "net/http" - "github.com/boojack/shortify/server/auth" + "github.com/boojack/shortify/api/v1/auth" "github.com/boojack/shortify/store" "github.com/labstack/echo/v4" diff --git a/server/auth/auth.go b/api/v1/auth/auth.go similarity index 96% rename from server/auth/auth.go rename to api/v1/auth/auth.go index 690c29d..7e54331 100644 --- a/server/auth/auth.go +++ b/api/v1/auth/auth.go @@ -33,11 +33,9 @@ const ( // 2. The access token has already expired, we refresh the token so that the ongoing request can pass through. CookieExpDuration = refreshTokenDuration - 1*time.Minute // AccessTokenCookieName is the cookie name of access token. - AccessTokenCookieName = "access-token" + AccessTokenCookieName = "shortify.access-token" // RefreshTokenCookieName is the cookie name of refresh token. - RefreshTokenCookieName = "refresh-token" - // UserIDCookieName is the cookie name of user ID. - UserIDCookieName = "user" + RefreshTokenCookieName = "shortify.refresh-token" ) type claimsMessage struct { diff --git a/api/v1/jwt.go b/api/v1/jwt.go index 9989fd3..cf5ad2f 100644 --- a/api/v1/jwt.go +++ b/api/v1/jwt.go @@ -7,8 +7,8 @@ import ( "strings" "time" + "github.com/boojack/shortify/api/v1/auth" "github.com/boojack/shortify/internal/util" - "github.com/boojack/shortify/server/auth" "github.com/boojack/shortify/store" "github.com/golang-jwt/jwt/v4" "github.com/labstack/echo/v4"