🛂 Clear auth context cache when logout for security

This commit is contained in:
2025-03-29 15:32:20 +08:00
parent cc7c96311f
commit 7389f70128
4 changed files with 9 additions and 3 deletions

View File

@ -1,8 +1,11 @@
package api
import (
"git.solsynth.dev/hypernet/nexus/pkg/nex/cachekit"
"git.solsynth.dev/hypernet/passport/pkg/authkit/models"
"git.solsynth.dev/hypernet/passport/pkg/internal/database"
"git.solsynth.dev/hypernet/passport/pkg/internal/gap"
"git.solsynth.dev/hypernet/passport/pkg/internal/services"
"git.solsynth.dev/hypernet/passport/pkg/internal/web/exts"
"github.com/gofiber/fiber/v2"
)
@ -51,6 +54,8 @@ func deleteTicket(c *fiber.Ctx) error {
AccountID: user.ID,
}).Error; err != nil {
return fiber.NewError(fiber.StatusNotFound, err.Error())
} else {
cachekit.Delete(gap.Ca, services.KgAuthContextCache(uint(id)))
}
return c.SendStatus(fiber.StatusOK)