Documentation ¶
Index ¶
- Variables
- func Admin() echo.MiddlewareFunc
- func CheckPermission(role, object string) bool
- func Developer() echo.MiddlewareFunc
- func DeveloperToken(id int, username string, role string) (string, error)
- func GetRBACByRole(role string) ([]string, bool)
- func GetUserID(c echo.Context) (uint, bool)
- func JWT() echo.MiddlewareFunc
- func MuvitToken(authToken, authSecret string) (string, error)
- func NewToken(id int, username string, role string) (string, error)
- func Super() echo.MiddlewareFunc
- func User() echo.MiddlewareFunc
Constants ¶
This section is empty.
Variables ¶
View Source
var PublicPath = []string{"/", "/healthz", "/api/user/register", "/api/user/login", "/api/dealership/template"}
PublicPath is a slice contain all paths that we don't use JWT middleware
View Source
var RBAC = struct { AllRBAC []string `role:"ALL"` SuperRBAC []string `role:"SUPER"` AdminRBAC []string `role:"ADMIN"` UserRBAC []string `role:"USER"` DeveloperRBAC []string `role:"DEVELOPER"` }{ AllRBAC: []string{"SUPER", "ADMIN", "DEVELOPER", "USER"}, SuperRBAC: []string{"SUPER", "ADMIN", "DEVELOPER", "USER"}, AdminRBAC: []string{"ADMIN", "USER"}, UserRBAC: []string{"USER"}, DeveloperRBAC: []string{"DEVELOPER"}, }
View Source
var StartBy = []string{"/api/inspection-result"}
Functions ¶
func Admin ¶
func Admin() echo.MiddlewareFunc
func CheckPermission ¶
func Developer ¶
func Developer() echo.MiddlewareFunc
func GetRBACByRole ¶
func JWT ¶
func JWT() echo.MiddlewareFunc
JWT provides a JSON Web Token (JWT) authentication middleware.
For valid token, it sets the user in context and calls next handler. For invalid token, it sends 401 - Unauthorized response. For missing or invalid Authorization header, it sends 400 - Bad Request.
func MuvitToken ¶
func Super ¶
func Super() echo.MiddlewareFunc
func User ¶
func User() echo.MiddlewareFunc
Types ¶
This section is empty.
Source Files ¶
Click to show internal directories.
Click to hide internal directories.