package aclmdl import ( "net/http" "corelab.mkcl.org/MKCLOS/coredevelopmentplatform/corepkgv2/authmdl/roleenforcemdl" "github.com/gin-gonic/gin" ) // ACLMiddleware ACLMiddleware func ACLMiddleware(configFilePath, JWTKey, groupKey string) gin.HandlerFunc { return func(c *gin.Context) { URL := c.Request.Header.Get("Service-Header") roleenforcemdl.LoadRoleConfiguration(configFilePath) if roleenforcemdl.Enforce(c.Request, URL, JWTKey, groupKey) { c.Next() } else { c.AbortWithStatus(http.StatusUnauthorized) } } }