upstream sync
This commit is contained in:
@@ -78,7 +78,12 @@ func (c *controller) handleAddOrganization(ctx echo.Context) error {
|
||||
func (c *controller) handle(ctx echo.Context) error {
|
||||
orgType, _ := routeutils.GetAndValidateStringQueryParam(ctx, "type", "Type is mandatory")
|
||||
|
||||
resp, err := c.svc.Organization.GetByType(orgType)
|
||||
authUser, err := auth.GetUserDetail(ctx, c.cfg)
|
||||
if err != nil {
|
||||
return routeutils.HandleAPIError(ctx, err)
|
||||
}
|
||||
|
||||
resp, err := c.svc.Organization.GetByType(orgType, authUser)
|
||||
if err != nil {
|
||||
return routeutils.HandleAPIError(ctx, err)
|
||||
}
|
||||
@@ -92,7 +97,12 @@ func (c *controller) handleDetail(ctx echo.Context) error {
|
||||
return routeutils.HandleAPIError(ctx, err)
|
||||
}
|
||||
|
||||
resp, err := c.svc.Organization.GetByUUID(orgUUID)
|
||||
authUser, err := auth.GetUserDetail(ctx, c.cfg)
|
||||
if err != nil {
|
||||
return routeutils.HandleAPIError(ctx, err)
|
||||
}
|
||||
|
||||
resp, err := c.svc.Organization.GetByUUID(orgUUID, authUser)
|
||||
if err != nil {
|
||||
return routeutils.HandleAPIError(ctx, err)
|
||||
}
|
||||
@@ -112,7 +122,12 @@ func (c *controller) handleParent(ctx echo.Context) error {
|
||||
return routeutils.HandleAPIError(ctx, err)
|
||||
}
|
||||
|
||||
resp, err := c.svc.Organization.SetParentOrganization(orgUUID, parent.UUID)
|
||||
authUser, err := auth.GetUserDetail(ctx, c.cfg)
|
||||
if err != nil {
|
||||
return routeutils.HandleAPIError(ctx, err)
|
||||
}
|
||||
|
||||
resp, err := c.svc.Organization.SetParentOrganization(orgUUID, parent.UUID, authUser)
|
||||
if err != nil {
|
||||
return routeutils.HandleAPIError(ctx, err)
|
||||
}
|
||||
@@ -132,12 +147,17 @@ func (c *controller) handleChild(ctx echo.Context) error {
|
||||
return routeutils.HandleAPIError(ctx, err)
|
||||
}
|
||||
|
||||
_, err = c.svc.Organization.SetParentOrganization(child.UUID, orgUUID)
|
||||
authUser, err := auth.GetUserDetail(ctx, c.cfg)
|
||||
if err != nil {
|
||||
return routeutils.HandleAPIError(ctx, err)
|
||||
}
|
||||
|
||||
resp, err := c.svc.Organization.GetByUUID(orgUUID)
|
||||
_, err = c.svc.Organization.SetParentOrganization(child.UUID, orgUUID, authUser)
|
||||
if err != nil {
|
||||
return routeutils.HandleAPIError(ctx, err)
|
||||
}
|
||||
|
||||
resp, err := c.svc.Organization.GetByUUID(orgUUID, authUser)
|
||||
if err != nil {
|
||||
return routeutils.HandleAPIError(ctx, err)
|
||||
}
|
||||
@@ -151,11 +171,16 @@ func (c *controller) handleNameSearch(ctx echo.Context) error {
|
||||
return routeutils.HandleAPIError(ctx, err)
|
||||
}
|
||||
|
||||
authUser, err := auth.GetUserDetail(ctx, c.cfg)
|
||||
if err != nil {
|
||||
return routeutils.HandleAPIError(ctx, err)
|
||||
}
|
||||
|
||||
searchType := ""
|
||||
searchType, _ = routeutils.GetAndValidateStringQueryParam(ctx, "type", "Type is mandatory")
|
||||
|
||||
cache := cache.Instance(c.cfg)
|
||||
cacheKey := ctx.Request().Method + ctx.Request().URL.RawPath + ctx.Request().URL.RawQuery
|
||||
cacheKey := ctx.Request().Method + ctx.Request().URL.RawPath + ctx.Request().URL.RawQuery + authUser.ID
|
||||
|
||||
resp := []viewmodel.Organization{}
|
||||
err = cache.GetStruct(cacheKey, &resp)
|
||||
@@ -163,7 +188,7 @@ func (c *controller) handleNameSearch(ctx echo.Context) error {
|
||||
if err != domain.ErrCacheMiss {
|
||||
ctx.Logger().Errorf(domain.LogProblemGettingFromCache, err)
|
||||
}
|
||||
resp, err = c.svc.Organization.GetByName(name, searchType)
|
||||
resp, err = c.svc.Organization.GetByName(name, searchType, authUser)
|
||||
if err != nil {
|
||||
return routeutils.HandleAPIError(ctx, err)
|
||||
}
|
||||
@@ -180,24 +205,24 @@ func (c *controller) handleRemoveAddress(ctx echo.Context) error {
|
||||
return routeutils.HandleAPIError(ctx, err)
|
||||
}
|
||||
|
||||
authUser, err := auth.GetUserDetail(ctx, c.cfg)
|
||||
if err != nil {
|
||||
return routeutils.HandleAPIError(ctx, err)
|
||||
}
|
||||
|
||||
orgUUID, err := routeutils.GetAndValidateStringParam(ctx, "org_uuid", "Org ID is mandatory")
|
||||
if err != nil {
|
||||
return routeutils.HandleAPIError(ctx, err)
|
||||
}
|
||||
|
||||
uInt, err := auth.GetTokenDetail(ctx, c.cfg)
|
||||
if err != nil {
|
||||
return routeutils.HandleAPIError(ctx, err)
|
||||
}
|
||||
createdUser := uInt.(map[string]interface{})
|
||||
address.UpdatedUser.ID = createdUser["useruuid"].(string)
|
||||
address.UpdatedUser.ID = authUser.ID
|
||||
|
||||
err = c.svc.Organization.InactivateOrganizationAddress(orgUUID, address)
|
||||
err = c.svc.Organization.InactivateOrganizationAddress(orgUUID, address, authUser)
|
||||
if err != nil {
|
||||
return routeutils.HandleAPIError(ctx, err)
|
||||
}
|
||||
|
||||
resp, err := c.svc.Organization.GetByUUID(orgUUID)
|
||||
resp, err := c.svc.Organization.GetByUUID(orgUUID, authUser)
|
||||
if err != nil {
|
||||
return routeutils.HandleAPIError(ctx, err)
|
||||
}
|
||||
@@ -217,20 +242,19 @@ func (c *controller) handleAddAddress(ctx echo.Context) error {
|
||||
return routeutils.HandleAPIError(ctx, err)
|
||||
}
|
||||
|
||||
uInt, err := auth.GetTokenDetail(ctx, c.cfg)
|
||||
authUser, err := auth.GetUserDetail(ctx, c.cfg)
|
||||
if err != nil {
|
||||
return routeutils.HandleAPIError(ctx, err)
|
||||
}
|
||||
createdUser := uInt.(map[string]interface{})
|
||||
address.CreatedUser.ID = createdUser["useruuid"].(string)
|
||||
address.UpdatedUser.ID = address.CreatedUser.ID
|
||||
address.CreatedUser.ID = authUser.ID
|
||||
address.UpdatedUser.ID = authUser.ID
|
||||
|
||||
_, err = c.svc.Organization.SetOrganizationAddress(orgUUID, address)
|
||||
_, err = c.svc.Organization.SetOrganizationAddress(orgUUID, address, authUser)
|
||||
if err != nil {
|
||||
return routeutils.HandleAPIError(ctx, err)
|
||||
}
|
||||
|
||||
resp, err := c.svc.Organization.GetByUUID(orgUUID)
|
||||
resp, err := c.svc.Organization.GetByUUID(orgUUID, authUser)
|
||||
if err != nil {
|
||||
return routeutils.HandleAPIError(ctx, err)
|
||||
}
|
||||
@@ -250,19 +274,18 @@ func (c *controller) handleRemoveContact(ctx echo.Context) error {
|
||||
return routeutils.HandleAPIError(ctx, err)
|
||||
}
|
||||
|
||||
uInt, err := auth.GetTokenDetail(ctx, c.cfg)
|
||||
authUser, err := auth.GetUserDetail(ctx, c.cfg)
|
||||
if err != nil {
|
||||
return routeutils.HandleAPIError(ctx, err)
|
||||
}
|
||||
createdUser := uInt.(map[string]interface{})
|
||||
contact.UpdatedUser.ID = createdUser["useruuid"].(string)
|
||||
contact.UpdatedUser.ID = authUser.ID
|
||||
|
||||
err = c.svc.Organization.InactivateOrganizationContact(orgUUID, contact)
|
||||
err = c.svc.Organization.InactivateOrganizationContact(orgUUID, contact, authUser)
|
||||
if err != nil {
|
||||
return routeutils.HandleAPIError(ctx, err)
|
||||
}
|
||||
|
||||
resp, err := c.svc.Organization.GetByUUID(orgUUID)
|
||||
resp, err := c.svc.Organization.GetByUUID(orgUUID, authUser)
|
||||
if err != nil {
|
||||
return routeutils.HandleAPIError(ctx, err)
|
||||
}
|
||||
@@ -282,20 +305,19 @@ func (c *controller) handleAddContact(ctx echo.Context) error {
|
||||
return routeutils.HandleAPIError(ctx, err)
|
||||
}
|
||||
|
||||
uInt, err := auth.GetTokenDetail(ctx, c.cfg)
|
||||
authUser, err := auth.GetUserDetail(ctx, c.cfg)
|
||||
if err != nil {
|
||||
return routeutils.HandleAPIError(ctx, err)
|
||||
}
|
||||
createdUser := uInt.(map[string]interface{})
|
||||
contact.CreatedUser.ID = createdUser["useruuid"].(string)
|
||||
contact.UpdatedUser.ID = contact.CreatedUser.ID
|
||||
contact.CreatedUser.ID = authUser.ID
|
||||
contact.UpdatedUser.ID = authUser.ID
|
||||
|
||||
_, err = c.svc.Organization.SetOrganizationContact(orgUUID, contact)
|
||||
_, err = c.svc.Organization.SetOrganizationContact(orgUUID, contact, authUser)
|
||||
if err != nil {
|
||||
return routeutils.HandleAPIError(ctx, err)
|
||||
}
|
||||
|
||||
resp, err := c.svc.Organization.GetByUUID(orgUUID)
|
||||
resp, err := c.svc.Organization.GetByUUID(orgUUID, authUser)
|
||||
if err != nil {
|
||||
return routeutils.HandleAPIError(ctx, err)
|
||||
}
|
||||
|
||||
@@ -104,8 +104,8 @@ func (c *controller) handleParticipating(ctx echo.Context) error {
|
||||
// long = -87.624225
|
||||
// }
|
||||
|
||||
lat = 40.442875
|
||||
long = -80.003112
|
||||
lat = 41.819078
|
||||
long = -87.623129
|
||||
|
||||
if len(mukID) > 0 {
|
||||
query = ""
|
||||
@@ -152,8 +152,8 @@ func (c *controller) handleList(ctx echo.Context) error {
|
||||
providerParams := npdmodel.ProviderSearchParams{
|
||||
Name: name,
|
||||
SearchBy: searchBy,
|
||||
Latitude: 40.442875,
|
||||
Longitude: -80.003112,
|
||||
Latitude: 41.819078,
|
||||
Longitude: -87.623129,
|
||||
Distance: distance,
|
||||
Limit: limit,
|
||||
Offset: 0,
|
||||
|
||||
@@ -274,6 +274,11 @@ func (c *controller) handleMember(ctx echo.Context) error {
|
||||
return routeutils.HandleAPIError(ctx, err)
|
||||
}
|
||||
|
||||
authUser, err := auth.GetUserDetail(ctx, c.cfg)
|
||||
if err != nil {
|
||||
return routeutils.HandleAPIError(ctx, err)
|
||||
}
|
||||
|
||||
if user.PhoneNumber == nil && user.Email == nil || len(*user.PhoneNumber) == 0 && len(*user.Email) == 0 {
|
||||
return routeutils.ResponseAPIAuthError(ctx, "phonenumber or email is required", false)
|
||||
}
|
||||
@@ -314,7 +319,7 @@ func (c *controller) handleMember(ctx echo.Context) error {
|
||||
}
|
||||
user.Profiles = append(user.Profiles, profile)
|
||||
|
||||
user, err = c.svc.Users.Create(user)
|
||||
user, err = c.svc.Users.Create(user, authUser)
|
||||
if err != nil {
|
||||
return routeutils.HandleAPIError(ctx, err)
|
||||
}
|
||||
@@ -328,6 +333,11 @@ func (c *controller) handleBulkPortal(ctx echo.Context) error {
|
||||
return routeutils.HandleAPIError(ctx, err)
|
||||
}
|
||||
|
||||
authUser, err := auth.GetUserDetail(ctx, c.cfg)
|
||||
if err != nil {
|
||||
return routeutils.HandleAPIError(ctx, err)
|
||||
}
|
||||
|
||||
for i, _ := range users {
|
||||
if len(users[i].Profiles) == 0 {
|
||||
return routeutils.ResponseAPIAuthError(ctx, "profile is required", false)
|
||||
@@ -360,7 +370,7 @@ func (c *controller) handleBulkPortal(ctx echo.Context) error {
|
||||
}
|
||||
}
|
||||
|
||||
returnUser, err := c.svc.Users.CreateBulk(users)
|
||||
returnUser, err := c.svc.Users.CreateBulk(users, authUser)
|
||||
if err != nil {
|
||||
return routeutils.HandleAPIError(ctx, err)
|
||||
}
|
||||
@@ -374,6 +384,11 @@ func (c *controller) handlePortal(ctx echo.Context) error {
|
||||
return routeutils.HandleAPIError(ctx, err)
|
||||
}
|
||||
|
||||
authUser, err := auth.GetUserDetail(ctx, c.cfg)
|
||||
if err != nil {
|
||||
return routeutils.HandleAPIError(ctx, err)
|
||||
}
|
||||
|
||||
if len(user.Profiles) == 0 {
|
||||
return routeutils.ResponseAPIAuthError(ctx, "profile is required", false)
|
||||
}
|
||||
@@ -404,7 +419,7 @@ func (c *controller) handlePortal(ctx echo.Context) error {
|
||||
user.Name = fmt.Sprintf("%s %s", user.First, user.Last)
|
||||
}
|
||||
|
||||
user, err = c.svc.Users.Create(user)
|
||||
user, err = c.svc.Users.Create(user, authUser)
|
||||
if err != nil {
|
||||
return routeutils.HandleAPIError(ctx, err)
|
||||
}
|
||||
|
||||
@@ -52,16 +52,16 @@ func (s *Server) Run() error {
|
||||
|
||||
s.srv.Debug = s.cfg.App.Debug
|
||||
|
||||
err := serverconfig.SetMiddlewares(s.srv, s.cfg, s.log, s.svc)
|
||||
if err != nil {
|
||||
return errors.Wrap(err)
|
||||
}
|
||||
|
||||
entityMapper := entitymapping.New()
|
||||
notificationService := notificationservice.New(s.svc, entityMapper, s.cfg, s.cache)
|
||||
appService := applicationservice.New(s.svc, entityMapper, notificationService, s.cfg)
|
||||
tncService := tncservice.New(s.svc, entityMapper, s.cfg, notificationService)
|
||||
|
||||
err := serverconfig.SetMiddlewares(s.srv, s.cfg, s.log, s.svc, appService)
|
||||
if err != nil {
|
||||
return errors.Wrap(err)
|
||||
}
|
||||
|
||||
router.Register(s.srv, s.cfg, appService, tncService, notificationService)
|
||||
|
||||
err = s.srv.Start(fmt.Sprintf(":%d", s.cfg.HTTP.Port))
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package serverconfig
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"bitbucket.org/nemt/nemt-portal-api/application/applicationservice"
|
||||
"bitbucket.org/nemt/nemt-portal-api/application/viewmodel"
|
||||
"bitbucket.org/nemt/nemt-portal-api/infra/auth"
|
||||
@@ -44,6 +46,8 @@ func MiddlewareWithConfig(cfg *config.Config, svc *applicationservice.Service, l
|
||||
|
||||
config := &DefaultConfig
|
||||
|
||||
config.Enforcer = casbin.NewEnforcer("authorization_model.conf", "authorization_policy.csv")
|
||||
|
||||
config.Svc = svc
|
||||
config.Logger = log
|
||||
config.Application = cfg
|
||||
@@ -68,26 +72,130 @@ func setAuthorizationMiddleware(e *echo.Echo, log *logger.Logger, cfg *config.Co
|
||||
func (a *Config) CheckPermission(c echo.Context) bool {
|
||||
user, err := auth.GetUserDetail(c, a.Application)
|
||||
if err != nil {
|
||||
a.Logger.Warningf("Cannot get user details. %v ", err)
|
||||
a.Logger.Warningf("Cannot get user details. %v\n", err)
|
||||
user = viewmodel.User{}
|
||||
}
|
||||
method := c.Request().Method
|
||||
path := c.Request().URL.Path
|
||||
//objectOrganization := a.organizationGoverningObject(c, user)
|
||||
|
||||
return a.Enforcer.Enforce(user, path, method)
|
||||
objectsRole, objectsOrganization, objectsOrganizationType, object := a.policyObjectAttributes(c, user)
|
||||
|
||||
currentUsersOrganization := viewmodel.Organization{}
|
||||
if len(user.Organizations) > 0 {
|
||||
currentUsersOrganization = user.Organizations[0]
|
||||
}
|
||||
|
||||
currentUsersRole := viewmodel.Profile{}
|
||||
if len(user.Profiles) > 0 {
|
||||
currentUsersRole = user.Profiles[0]
|
||||
}
|
||||
|
||||
currentUsersOrganizationType := ""
|
||||
if len(user.Profiles) > 0 {
|
||||
currentUsersOrganizationType = user.Profiles[0].Organization.Type.Key
|
||||
}
|
||||
|
||||
orgRelation := organizationsRelation(currentUsersOrganization, objectsOrganization)
|
||||
objRelation := a.objectRelation(object, user)
|
||||
|
||||
// parameters to Enforce must match the request section of the authorization_model.conf
|
||||
return a.Enforcer.Enforce(currentUsersRole.Key,
|
||||
objectsRole.Key,
|
||||
objectsOrganizationType,
|
||||
currentUsersOrganizationType,
|
||||
orgRelation,
|
||||
objRelation,
|
||||
path,
|
||||
method)
|
||||
|
||||
}
|
||||
|
||||
func (a *Config) organizationGoverningObject(c echo.Context, userDetails viewmodel.User) (result viewmodel.Organization) {
|
||||
// policyObjectAttributes returns all information about the object being accessed for the policy
|
||||
// in case object exists and returns users information if it is a new object
|
||||
func (a *Config) policyObjectAttributes(c echo.Context, userDetails viewmodel.User) (viewmodel.Profile, viewmodel.Organization, string, interface{}) {
|
||||
|
||||
existingUser := strings.Contains(c.Request().URL.Path, "/users") && len(c.ParamValues()) > 0
|
||||
newUser := strings.Contains(c.Request().URL.Path, "/users") && len(c.ParamValues()) <= 0
|
||||
var object interface{}
|
||||
|
||||
const userIDParamName = "user_uuid"
|
||||
existingUser := strings.Contains(c.Request().URL.Path, "/users/") && c.Param(userIDParamName) != ""
|
||||
newUser := strings.Contains(c.Request().URL.Path, "/users/") && c.Param(userIDParamName) == ""
|
||||
|
||||
const organizationIDParamName = "org_uuid"
|
||||
existingOrganization := strings.Contains(c.Request().URL.Path, "/organization") && c.Param(organizationIDParamName) != ""
|
||||
newOrganization := strings.Contains(c.Request().URL.Path, "/organization") && c.Param(organizationIDParamName) == ""
|
||||
|
||||
fmt.Println("**********")
|
||||
fmt.Printf("url %v\n", c.Param(userIDParamName))
|
||||
fmt.Printf("user %v\n", userDetails.ID)
|
||||
fmt.Printf("existing %v\n", existingUser)
|
||||
fmt.Printf("new %v\n", newUser)
|
||||
fmt.Println("**********")
|
||||
|
||||
switch {
|
||||
case existingUser:
|
||||
user, _ := a.Svc.Users.GetByUUID(c.ParamValues()[0], "")
|
||||
result = user.Organizations[0]
|
||||
case newUser:
|
||||
result = userDetails.Organizations[0]
|
||||
object, _ = a.Svc.Users.GetByUUID(c.Param(userIDParamName), "")
|
||||
case newUser && len(userDetails.Organizations) > 0:
|
||||
object = userDetails
|
||||
case existingOrganization:
|
||||
object, _ = a.Svc.Organization.GetByUUID(c.Param(organizationIDParamName), userDetails)
|
||||
case newOrganization:
|
||||
object = viewmodel.Organization{}
|
||||
}
|
||||
return
|
||||
|
||||
objectsRole := viewmodel.Profile{}
|
||||
switch obj := object.(type) {
|
||||
case viewmodel.User:
|
||||
if len(obj.Profiles) > 0 {
|
||||
objectsRole = obj.Profiles[0]
|
||||
}
|
||||
}
|
||||
|
||||
objectsOrganization := viewmodel.Organization{}
|
||||
switch obj := object.(type) {
|
||||
case viewmodel.User:
|
||||
if len(obj.Profiles) > 0 {
|
||||
objectsOrganization = obj.Profiles[0].Organization
|
||||
}
|
||||
case viewmodel.Organization:
|
||||
objectsOrganization = obj
|
||||
}
|
||||
|
||||
objectsOrganizationType := objectsOrganization.Type.Key
|
||||
|
||||
return objectsRole, objectsOrganization, objectsOrganizationType, object
|
||||
}
|
||||
|
||||
func organizationsRelation(requestOrganization, currentUsersOrganization viewmodel.Organization) string {
|
||||
if requestOrganization.UUID == currentUsersOrganization.UUID {
|
||||
return "[equal]"
|
||||
}
|
||||
|
||||
for _, childOrg := range currentUsersOrganization.ChildOrgs {
|
||||
if childOrg.UUID == requestOrganization.UUID {
|
||||
return "[equal-or-child]"
|
||||
}
|
||||
}
|
||||
|
||||
for _, childOrg := range requestOrganization.ChildOrgs {
|
||||
if childOrg.UUID == currentUsersOrganization.UUID {
|
||||
return "[parent]"
|
||||
}
|
||||
}
|
||||
|
||||
return "[unrelated]"
|
||||
}
|
||||
|
||||
// organizationGoverningObject returns the role that is the owner of the object that is being accessed
|
||||
// in case object exists and returns users role if it is a new object
|
||||
func (a *Config) objectRelation(object interface{}, currentUser viewmodel.User) string {
|
||||
|
||||
switch obj := object.(type) {
|
||||
case viewmodel.User:
|
||||
if obj.ID == currentUser.ID {
|
||||
return "[self]"
|
||||
} else {
|
||||
return "[other]"
|
||||
}
|
||||
}
|
||||
return "[other]"
|
||||
}
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
[request_definition]
|
||||
r = role, obj, act
|
||||
|
||||
[policy_definition]
|
||||
p = role, obj, act
|
||||
|
||||
[policy_effect]
|
||||
e = some(where (p.eft == allow)) && !some(where (p.eft == deny))
|
||||
|
||||
[matchers]
|
||||
m = keymatch(r.role, p.role) && keyMatch(r.obj, p.obj) && (r.act == p.act || p.act == "*")
|
||||
@@ -1,6 +1,7 @@
|
||||
package serverconfig
|
||||
|
||||
import (
|
||||
"bitbucket.org/nemt/nemt-portal-api/application/applicationservice"
|
||||
"bitbucket.org/nemt/nemt-portal-api/domain/service"
|
||||
"bitbucket.org/nemt/nemt-portal-api/infra/config"
|
||||
"bitbucket.org/nemt/nemt-portal-api/infra/errors"
|
||||
@@ -9,7 +10,7 @@ import (
|
||||
)
|
||||
|
||||
// SetMiddlewares attaches middlewares to server
|
||||
func SetMiddlewares(server *echo.Echo, cfg *config.Config, log *logger.Logger, svc *service.Service) error {
|
||||
func SetMiddlewares(server *echo.Echo, cfg *config.Config, log *logger.Logger, svc *service.Service, appsvc *applicationservice.Service) error {
|
||||
setRecoverMiddleware(server)
|
||||
setGZIPMiddleware(server)
|
||||
setRequestIDMiddleware(server)
|
||||
@@ -17,7 +18,7 @@ func SetMiddlewares(server *echo.Echo, cfg *config.Config, log *logger.Logger, s
|
||||
setCORSMiddleware(server, cfg)
|
||||
setBodyLimitMiddleware(server)
|
||||
setRateLimitMiddleware(server)
|
||||
//setAuthorizationMiddleware(server, log, svc)
|
||||
//setAuthorizationMiddleware(server, log, cfg, appsvc)
|
||||
|
||||
err := setJWTMiddleware(server, cfg)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user