diff --git a/internal/context/context.go b/internal/context/context.go index efc3ff1..55d90a4 100644 --- a/internal/context/context.go +++ b/internal/context/context.go @@ -51,7 +51,6 @@ type NFContext interface { var _ NFContext = &AMFContext{} - type AMFContext struct { EventSubscriptionIDGenerator *idgenerator.IDGenerator EventSubscriptions sync.Map @@ -564,7 +563,7 @@ func (c *AMFContext) GetTokenCtx(scope string, targetNF models.NfType) ( if !c.OAuth2Required { return context.TODO(), nil, nil } - return oauth.GetTokenCtx(models.NfType_AMF,targetNF, + return oauth.GetTokenCtx(models.NfType_AMF, targetNF, c.NfId, c.NrfUri, scope) } @@ -576,4 +575,4 @@ func (c *AMFContext) AuthorizationCheck(token, serviceName string) error { logger.UtilLog.Debugf("AMFContext::AuthorizationCheck: token[%s] serviceName[%s]\n", token, serviceName) return oauth.VerifyOAuth(token, serviceName, c.NrfCertPem) -} \ No newline at end of file +} diff --git a/internal/sbi/communication/api_individual_subscription_document.go b/internal/sbi/communication/api_individual_subscription_document.go index e6d47cf..4ec76b3 100644 --- a/internal/sbi/communication/api_individual_subscription_document.go +++ b/internal/sbi/communication/api_individual_subscription_document.go @@ -13,6 +13,7 @@ import ( "net/http" "github.com/gin-gonic/gin" + "github.com/free5gc/amf/internal/logger" "github.com/free5gc/amf/internal/sbi/producer" "github.com/free5gc/openapi" diff --git a/internal/sbi/communication/api_n1_n2_message_collection_document.go b/internal/sbi/communication/api_n1_n2_message_collection_document.go index f0c0f15..1c53f4b 100644 --- a/internal/sbi/communication/api_n1_n2_message_collection_document.go +++ b/internal/sbi/communication/api_n1_n2_message_collection_document.go @@ -25,7 +25,6 @@ import ( // N1N2MessageTransfer - Namf_Communication N1N2 Message Transfer (UE Specific) service Operation func HTTPN1N2MessageTransfer(c *gin.Context) { - var n1n2MessageTransferRequest models.N1N2MessageTransferRequest n1n2MessageTransferRequest.JsonData = new(models.N1N2MessageTransferReqData) diff --git a/internal/sbi/communication/api_n1_n2_subscriptions_collection_for_individual_ue_contexts_document.go b/internal/sbi/communication/api_n1_n2_subscriptions_collection_for_individual_ue_contexts_document.go index 6f6dbee..cdae9b7 100644 --- a/internal/sbi/communication/api_n1_n2_subscriptions_collection_for_individual_ue_contexts_document.go +++ b/internal/sbi/communication/api_n1_n2_subscriptions_collection_for_individual_ue_contexts_document.go @@ -24,8 +24,6 @@ import ( func HTTPN1N2MessageSubscribe(c *gin.Context) { var ueN1N2InfoSubscriptionCreateData models.UeN1N2InfoSubscriptionCreateData - - requestBody, err := c.GetRawData() if err != nil { logger.CommLog.Errorf("Get Request Body error: %+v", err) diff --git a/internal/sbi/communication/routers.go b/internal/sbi/communication/routers.go index 4040e3b..e999b58 100644 --- a/internal/sbi/communication/routers.go +++ b/internal/sbi/communication/routers.go @@ -15,15 +15,17 @@ import ( "github.com/gin-gonic/gin" "github.com/sirupsen/logrus" - "github.com/free5gc/amf/internal/util" - "github.com/free5gc/openapi/models" + + amf_context "github.com/free5gc/amf/internal/context" "github.com/free5gc/amf/internal/logger" + "github.com/free5gc/amf/internal/util" "github.com/free5gc/amf/pkg/factory" + "github.com/free5gc/openapi/models" 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() { @@ -59,7 +61,7 @@ func AddService(engine *gin.Engine) *gin.RouterGroup { group.Use(func(c *gin.Context) { routerAuthorizationCheck.Check(c, amf_context.GetSelf()) }) - + for _, route := range routes { switch route.Method { case "GET": diff --git a/internal/sbi/eventexposure/routers.go b/internal/sbi/eventexposure/routers.go index 2aaecb5..8cbb10f 100644 --- a/internal/sbi/eventexposure/routers.go +++ b/internal/sbi/eventexposure/routers.go @@ -15,15 +15,16 @@ import ( "github.com/gin-gonic/gin" + amf_context "github.com/free5gc/amf/internal/context" "github.com/free5gc/amf/internal/logger" - "github.com/free5gc/amf/pkg/factory" "github.com/free5gc/amf/internal/util" + "github.com/free5gc/amf/pkg/factory" "github.com/free5gc/openapi/models" logger_util "github.com/free5gc/util/logger" - amf_context "github.com/free5gc/amf/internal/context" ) const serviceName string = string(models.ServiceName_NAMF_EVTS) + // Route is the information for every URI. type Route struct { // Name is the name of this Route. diff --git a/internal/sbi/location/routers.go b/internal/sbi/location/routers.go index 3a8f81e..280b82f 100644 --- a/internal/sbi/location/routers.go +++ b/internal/sbi/location/routers.go @@ -15,12 +15,12 @@ import ( "github.com/gin-gonic/gin" + amf_context "github.com/free5gc/amf/internal/context" "github.com/free5gc/amf/internal/logger" - "github.com/free5gc/amf/pkg/factory" "github.com/free5gc/amf/internal/util" + "github.com/free5gc/amf/pkg/factory" "github.com/free5gc/openapi/models" logger_util "github.com/free5gc/util/logger" - amf_context "github.com/free5gc/amf/internal/context" ) const serviceName string = string(models.ServiceName_NAMF_LOC) diff --git a/internal/sbi/mt/routers.go b/internal/sbi/mt/routers.go index d3dafca..093e616 100644 --- a/internal/sbi/mt/routers.go +++ b/internal/sbi/mt/routers.go @@ -15,15 +15,16 @@ import ( "github.com/gin-gonic/gin" + amf_context "github.com/free5gc/amf/internal/context" "github.com/free5gc/amf/internal/logger" - "github.com/free5gc/amf/pkg/factory" "github.com/free5gc/amf/internal/util" + "github.com/free5gc/amf/pkg/factory" "github.com/free5gc/openapi/models" logger_util "github.com/free5gc/util/logger" - amf_context "github.com/free5gc/amf/internal/context" ) const serviceName string = string(models.ServiceName_NAMF_MT) + // Route is the information for every URI. type Route struct { // Name is the name of this Route. diff --git a/internal/util/router_auth_check.go b/internal/util/router_auth_check.go index 1ea4ba3..1c2349c 100644 --- a/internal/util/router_auth_check.go +++ b/internal/util/router_auth_check.go @@ -30,4 +30,4 @@ func (rac *RouterAuthorizationCheck) Check(c *gin.Context, amfContext amf_contex } logger.UtilLog.Debugf("RouterAuthorizationCheck: Check Authorized") -} \ No newline at end of file +} diff --git a/internal/util/router_auth_check_test.go b/internal/util/router_auth_check_test.go index 256d4d4..4dbc1fe 100644 --- a/internal/util/router_auth_check_test.go +++ b/internal/util/router_auth_check_test.go @@ -88,4 +88,4 @@ func TestRouterAuthorizationCheck_Check(t *testing.T) { } }) } -} \ No newline at end of file +}