func GormJWTInjector(db *gorm.DB) func(next echo.HandlerFunc) echo.HandlerFunc {
return func(next echo.HandlerFunc) echo.HandlerFunc {
return func(c echo.Context) error {
if userToken := c.Get("user"); userToken != nil {
claims := userToken.(*jwt.Token).Claims.(jwt.MapClaims)
user := User{
gorm.Model{
ID: uint(claims["id"].(float64)),
},
}
db = db.Set("audited:current_user", user)
c.Set(gromDB, db)
}
return next(c)
}
}
}
-
Notifications
You must be signed in to change notification settings - Fork 0
mhewedy/echo-gorm-audited-example
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
No description, website, or topics provided.
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published