Skip to content

Commit

Permalink
finished communication/routers.go
Browse files Browse the repository at this point in the history
  • Loading branch information
HanHongChen committed Jan 22, 2024
1 parent 9290372 commit f7f076f
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions internal/sbi/communication/routers.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,15 @@ import (

"github.com/gin-gonic/gin"
"github.com/sirupsen/logrus"

"github.com/free5gc/amf/internal/util"
"github.com/free5gc/openapi/models"
"github.com/free5gc/amf/internal/logger"
"github.com/free5gc/amf/pkg/factory"
logger_util "github.com/free5gc/util/logger"

amf_context "github.com/free5gc/amf/internal/context"
)

const serviceName string = string(models.ServiceName_NAMF_COMM)
var HttpLog *logrus.Entry

func init() {
Expand Down Expand Up @@ -53,6 +55,11 @@ func NewRouter() *gin.Engine {
func AddService(engine *gin.Engine) *gin.RouterGroup {
group := engine.Group(factory.AmfCommResUriPrefix)

routerAuthorizationCheck := util.NewRouterAuthorizationCheck(serviceName)
group.Use(func(c *gin.Context) {
routerAuthorizationCheck.Check(c, amf_context.GetSelf())
})

for _, route := range routes {
switch route.Method {
case "GET":
Expand Down

0 comments on commit f7f076f

Please sign in to comment.