Skip to content

Commit

Permalink
Feature: Add service producer authorizationCheck
Browse files Browse the repository at this point in the history
  • Loading branch information
andy89923 committed Nov 7, 2023
1 parent 91bcdad commit c6b5341
Show file tree
Hide file tree
Showing 41 changed files with 470 additions and 1 deletion.
1 change: 0 additions & 1 deletion internal/sbi/consumer/nf_accesstoken.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (
"golang.org/x/oauth2"

"github.com/free5gc/openapi"

"github.com/free5gc/openapi/Nnrf_AccessToken"
"github.com/free5gc/openapi/models"
udr_context "github.com/free5gc/udr/internal/context"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ import (

// HTTPQueryAmData - Retrieves the access and mobility subscription data of a UE
func HTTPQueryAmData(c *gin.Context) {
auth_err := authorizationCheck(c)
if auth_err != nil {
return
}

req := httpwrapper.NewRequest(c.Request, nil)
req.Params["ueId"] = c.Params.ByName("ueId")
req.Params["servingPlmnId"] = c.Params.ByName("servingPlmnId")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ import (

// HTTPAmfContext3gpp - To modify the AMF context data of a UE using 3gpp access in the UDR
func HTTPAmfContext3gpp(c *gin.Context) {
auth_err := authorizationCheck(c)
if auth_err != nil {
return
}

var patchItemArray []models.PatchItem

requestBody, err := c.GetRawData()
Expand Down Expand Up @@ -72,6 +77,11 @@ func HTTPAmfContext3gpp(c *gin.Context) {

// HTTPCreateAmfContext3gpp - To store the AMF context data of a UE using 3gpp access in the UDR
func HTTPCreateAmfContext3gpp(c *gin.Context) {
auth_err := authorizationCheck(c)
if auth_err != nil {
return
}

var amf3GppAccessRegistration models.Amf3GppAccessRegistration

requestBody, err := c.GetRawData()
Expand Down Expand Up @@ -121,6 +131,11 @@ func HTTPCreateAmfContext3gpp(c *gin.Context) {

// HTTPQueryAmfContext3gpp - Retrieves the AMF context data of a UE using 3gpp access
func HTTPQueryAmfContext3gpp(c *gin.Context) {
auth_err := authorizationCheck(c)
if auth_err != nil {
return
}

req := httpwrapper.NewRequest(c.Request, nil)
req.Params["ueId"] = c.Params.ByName("ueId")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ import (

// HTTPAmfContextNon3gpp - To modify the AMF context data of a UE using non 3gpp access in the UDR
func HTTPAmfContextNon3gpp(c *gin.Context) {
auth_err := authorizationCheck(c)
if auth_err != nil {
return
}

var patchItemArray []models.PatchItem

requestBody, err := c.GetRawData()
Expand Down Expand Up @@ -72,6 +77,11 @@ func HTTPAmfContextNon3gpp(c *gin.Context) {

// HTTPCreateAmfContextNon3gpp - To store the AMF context data of a UE using non-3gpp access in the UDR
func HTTPCreateAmfContextNon3gpp(c *gin.Context) {
auth_err := authorizationCheck(c)
if auth_err != nil {
return
}

var amfNon3GppAccessRegistration models.AmfNon3GppAccessRegistration

requestBody, err := c.GetRawData()
Expand Down Expand Up @@ -121,6 +131,11 @@ func HTTPCreateAmfContextNon3gpp(c *gin.Context) {

// HTTPQueryAmfContextNon3gpp - Retrieves the AMF context data of a UE using non-3gpp access
func HTTPQueryAmfContextNon3gpp(c *gin.Context) {
auth_err := authorizationCheck(c)
if auth_err != nil {
return
}

req := httpwrapper.NewRequest(c.Request, nil)
req.Params["ueId"] = c.Params.ByName("ueId")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ import (

// HTTPModifyAmfSubscriptionInfo - modify the AMF Subscription Info
func HTTPModifyAmfSubscriptionInfo(c *gin.Context) {
auth_err := authorizationCheck(c)
if auth_err != nil {
return
}

var patchItemArray []models.PatchItem

requestBody, err := c.GetRawData()
Expand Down
10 changes: 10 additions & 0 deletions internal/sbi/datarepository/api_authentication_data_document.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ import (

// HTTPModifyAuthentication - modify the authentication subscription data of a UE
func HTTPModifyAuthentication(c *gin.Context) {
auth_err := authorizationCheck(c)
if auth_err != nil {
return
}

var patchItemArray []models.PatchItem

requestBody, err := c.GetRawData()
Expand Down Expand Up @@ -72,6 +77,11 @@ func HTTPModifyAuthentication(c *gin.Context) {

// HTTPQueryAuthSubsData - Retrieves the authentication subscription data of a UE
func HTTPQueryAuthSubsData(c *gin.Context) {
auth_err := authorizationCheck(c)
if auth_err != nil {
return
}

req := httpwrapper.NewRequest(c.Request, nil)
req.Params["ueId"] = c.Params.ByName("ueId")

Expand Down
10 changes: 10 additions & 0 deletions internal/sbi/datarepository/api_authentication_so_r_document.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ import (

// HTTPCreateAuthenticationSoR - To store the SoR acknowledgement information of a UE
func HTTPCreateAuthenticationSoR(c *gin.Context) {
auth_err := authorizationCheck(c)
if auth_err != nil {
return
}

var sorData models.SorData

requestBody, err := c.GetRawData()
Expand Down Expand Up @@ -72,6 +77,11 @@ func HTTPCreateAuthenticationSoR(c *gin.Context) {

// HTTPQueryAuthSoR - Retrieves the SoR acknowledgement information of a UE
func HTTPQueryAuthSoR(c *gin.Context) {
auth_err := authorizationCheck(c)
if auth_err != nil {
return
}

req := httpwrapper.NewRequest(c.Request, nil)
req.Params["ueId"] = c.Params.ByName("ueId")

Expand Down
10 changes: 10 additions & 0 deletions internal/sbi/datarepository/api_authentication_status_document.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ import (

// HTTPCreateAuthenticationStatus - To store the Authentication Status data of a UE
func HTTPCreateAuthenticationStatus(c *gin.Context) {
auth_err := authorizationCheck(c)
if auth_err != nil {
return
}

var authEvent models.AuthEvent

requestBody, err := c.GetRawData()
Expand Down Expand Up @@ -72,6 +77,11 @@ func HTTPCreateAuthenticationStatus(c *gin.Context) {

// HTTPQueryAuthenticationStatus - Retrieves the Authentication Status of a UE
func HTTPQueryAuthenticationStatus(c *gin.Context) {
auth_err := authorizationCheck(c)
if auth_err != nil {
return
}

req := httpwrapper.NewRequest(c.Request, nil)
req.Params["ueId"] = c.Params.ByName("ueId")

Expand Down
Loading

0 comments on commit c6b5341

Please sign in to comment.