Skip to content

Commit

Permalink
feat: update server routes
Browse files Browse the repository at this point in the history
  • Loading branch information
TYuan0816 committed Aug 18, 2024
1 parent f4242a7 commit ca84870
Show file tree
Hide file tree
Showing 4 changed files with 99 additions and 16 deletions.
10 changes: 7 additions & 3 deletions internal/sbi/api_sorprotection.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,22 @@ import (
func (s *Server) getSorprotectionRoutes() []Route {
return []Route{
{
Name: "Index",
Method: http.MethodGet,
Pattern: "/",
APIFunc: Index,
APIFunc: func(c *gin.Context) {
c.String(http.StatusOK, "Hello free5GC!")
},
},
{
Name: "SupiUeSorPost",
Method: http.MethodPost,
Pattern: "/:supi/ue-sor",
APIFunc: s.SupiUeSorPost,
APIFunc: s.HTTPSupiUeSorPost,
},
}
}

func (s *Server) SupiUeSorPost(c *gin.Context) {
func (s *Server) HTTPSupiUeSorPost(c *gin.Context) {
c.JSON(http.StatusNotImplemented, gin.H{})
}
94 changes: 84 additions & 10 deletions internal/sbi/api_ueauthentication.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,30 +29,78 @@ func Index(c *gin.Context) {
func (s *Server) getUeAuthenticationRoutes() []Route {
return []Route{
{
Name: "Index",
Method: http.MethodGet,
Pattern: "/",
APIFunc: Index,
APIFunc: func(c *gin.Context) {
c.String(http.StatusOK, "Hello free5GC!")
},
},
{
Name: "EapAuthMethod",
Method: http.MethodPost,
Pattern: "/ue-authentications/:authCtxId/eap-session",
APIFunc: s.EapAuthMethodPost,
APIFunc: s.HTTPEapAuthMethod,
},
{
Name: "UeAuthenticationsPost",
Method: http.MethodPost,
Pattern: "/ue-authentications",
APIFunc: s.UeAuthenticationsPost,
APIFunc: s.HTTPUeAuthenticationsPost,
},
{
Name: "UeAuthenticationsAuthCtxId5gAkaConfirmationPut",
Method: http.MethodPut,
Pattern: "/ue-authentications/:authCtxId/5g-aka-confirmation",
APIFunc: s.UeAuthenticationsAuthCtxID5gAkaConfirmationPut,
APIFunc: s.HTTPUeAuthenticationsAuthCtxId5gAkaConfirmationPut,
},

{
Name: "Delete5gAkaAuthenticationResult",
Method: http.MethodDelete,
Pattern: "/ue-authentications/:authCtxId/5g-aka-confirmation",
APIFunc: s.HTTPDelete5gAkaAuthenticationResult,
},
{
Name: "DeleteEapAuthenticationResult",
Method: http.MethodDelete,
Pattern: "/ue-authentications/:authCtxId/eap-session",
APIFunc: s.HTTPDeleteEapAuthenticationResult,
},
{
Name: "DeleteProSeAuthenticationResult",
Method: http.MethodDelete,
Pattern: "/prose-authentications/:authCtxId/prose-auth",
APIFunc: s.HTTPDeleteProSeAuthenticationResult,
},
{
Name: "ProseAuth",
Method: http.MethodPost,
Pattern: "/prose-authentications",
APIFunc: s.HTTPProseAuth,
},
{
Name: "ProseAuthenticationsPost",
Method: http.MethodPost,
Pattern: "/prose-authentications/:authCtxId/prose-auth",
APIFunc: s.HTTPProseAuthenticationsPost,
},
{
Name: "RgAuthenticationsPost",
Method: http.MethodPost,
Pattern: "/rg-authentications/:authCtxId",
APIFunc: s.HTTPRgAuthenticationsPost,
},
{
Name: "UeAuthenticationsDeregisterPost",
Method: http.MethodPost,
Pattern: "/ue-authentications/deregister",
APIFunc: s.HTTPUeAuthenticationsDeregisterPost,
},
}
}

// EapAuthMethodPost -
func (s *Server) EapAuthMethodPost(c *gin.Context) {
func (s *Server) HTTPEapAuthMethod(c *gin.Context) {
var eapSessionReq models.EapSession

requestBody, err := c.GetRawData()
Expand Down Expand Up @@ -85,8 +133,7 @@ func (s *Server) EapAuthMethodPost(c *gin.Context) {
s.Processor().HandleEapAuthComfirmRequest(c, eapSessionReq, eapSessionId)
}

// UeAuthenticationsPost
func (s *Server) UeAuthenticationsPost(c *gin.Context) {
func (s *Server) HTTPUeAuthenticationsPost(c *gin.Context) {
var authInfo models.AuthenticationInfo

requestBody, err := c.GetRawData()
Expand Down Expand Up @@ -118,8 +165,7 @@ func (s *Server) UeAuthenticationsPost(c *gin.Context) {
s.Processor().HandleUeAuthPostRequest(c, authInfo)
}

// UeAuthenticationsAuthCtxID5gAkaConfirmationPut
func (s *Server) UeAuthenticationsAuthCtxID5gAkaConfirmationPut(c *gin.Context) {
func (s *Server) HTTPUeAuthenticationsAuthCtxId5gAkaConfirmationPut(c *gin.Context) {
var confirmationData models.ConfirmationData

requestBody, err := c.GetRawData()
Expand Down Expand Up @@ -151,3 +197,31 @@ func (s *Server) UeAuthenticationsAuthCtxID5gAkaConfirmationPut(c *gin.Context)

s.Processor().HandleAuth5gAkaComfirmRequest(c, confirmationData, confirmationDataResponseId)
}

func (s *Server) HTTPDelete5gAkaAuthenticationResult(c *gin.Context) {
c.JSON(http.StatusNotImplemented, gin.H{})
}

func (s *Server) HTTPDeleteEapAuthenticationResult(c *gin.Context) {
c.JSON(http.StatusNotImplemented, gin.H{})
}

func (s *Server) HTTPDeleteProSeAuthenticationResult(c *gin.Context) {
c.JSON(http.StatusNotImplemented, gin.H{})
}

func (s *Server) HTTPProseAuth(c *gin.Context) {
c.JSON(http.StatusNotImplemented, gin.H{})
}

func (s *Server) HTTPProseAuthenticationsPost(c *gin.Context) {
c.JSON(http.StatusNotImplemented, gin.H{})
}

func (s *Server) HTTPRgAuthenticationsPost(c *gin.Context) {
c.JSON(http.StatusNotImplemented, gin.H{})
}

func (s *Server) HTTPUeAuthenticationsDeregisterPost(c *gin.Context) {
c.JSON(http.StatusNotImplemented, gin.H{})
}
10 changes: 7 additions & 3 deletions internal/sbi/api_upuprotection.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,22 @@ import (
func (s *Server) getUpuprotectionRoutes() []Route {
return []Route{
{
Name: "Index",
Method: http.MethodGet,
Pattern: "/",
APIFunc: Index,
APIFunc: func(c *gin.Context) {
c.String(http.StatusOK, "Hello free5GC!")
},
},
{
Name: "SupiUeUpuPost",
Method: http.MethodPost,
Pattern: "/:supi/ue-upu",
APIFunc: s.SupiUeUpuPost,
APIFunc: s.HTTPSupiUeUpuPost,
},
}
}

func (s *Server) SupiUeUpuPost(c *gin.Context) {
func (s *Server) HTTPSupiUeUpuPost(c *gin.Context) {
c.JSON(http.StatusNotImplemented, gin.H{})
}
1 change: 1 addition & 0 deletions internal/sbi/routes.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package sbi
import "github.com/gin-gonic/gin"

type Route struct {
Name string
Method string
Pattern string
APIFunc gin.HandlerFunc
Expand Down

0 comments on commit ca84870

Please sign in to comment.