From 677bd5cfc977e3295e760c435422e9e229b880f1 Mon Sep 17 00:00:00 2001 From: kolaente Date: Thu, 31 Aug 2023 21:40:43 +0200 Subject: [PATCH] feat(api tokens): check for expiry date --- pkg/routes/routes.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkg/routes/routes.go b/pkg/routes/routes.go index 4350d17ab..0c84e73f9 100644 --- a/pkg/routes/routes.go +++ b/pkg/routes/routes.go @@ -312,6 +312,10 @@ func registerAPIRoutes(a *echo.Group) { return echo.NewHTTPError(http.StatusInternalServerError).SetInternal(err) } + if token.ExpiresAt.After(time.Now()) { + return echo.NewHTTPError(http.StatusUnauthorized) + } + c.Set("api_token", token) return next(c)