feat: add session expiration tracking and validation
feat: implement Redis caching for terminated sessions feat: add new session GUID queries for validation refactor: extend Session model with last_refresh_exp_time refactor: update token generation to include role and session refactor: modify auth middleware to validate session status refactor: replace GetUserSessions with GetValidUserSessions chore: add uuid/v5 dependency fix: update router to pass dependencies to auth middleware chore: update SQL schema and queries for new expiration field
This commit is contained in:
@@ -19,14 +19,17 @@ package routes
|
||||
|
||||
import (
|
||||
"easywish/internal/controllers"
|
||||
"easywish/internal/database"
|
||||
"easywish/internal/middleware"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/go-redis/redis/v8"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
func NewRouter(engine *gin.Engine, groups []RouteGroup) *gin.Engine {
|
||||
func NewRouter(engine *gin.Engine, log *zap.Logger, dbctx database.DbContext, redisClient *redis.Client, groups []RouteGroup) *gin.Engine {
|
||||
apiGroup := engine.Group("/api")
|
||||
apiGroup.Use(middleware.AuthMiddleware())
|
||||
apiGroup.Use(middleware.AuthMiddleware(log, dbctx, redisClient))
|
||||
for _, group := range groups {
|
||||
subgroup := apiGroup.Group(group.BasePath)
|
||||
subgroup.Use(group.Middleware...)
|
||||
|
||||
Reference in New Issue
Block a user