feat(api tokens): check for expiry date

This commit is contained in:
kolaente 2023-08-31 21:40:43 +02:00
parent fb2a1c59db
commit 677bd5cfc9
Signed by untrusted user: konrad
GPG Key ID: F40E70337AB24C9B
1 changed files with 4 additions and 0 deletions

View File

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