From a2e86c1c0d0475e99e5ce1cbd857473c58367ea5 Mon Sep 17 00:00:00 2001 From: "CTFang@WireLab" Date: Thu, 7 Dec 2023 06:15:21 +0000 Subject: [PATCH] Fix: remove unused code --- internal/util/nf_authorization.go | 3 +-- pkg/factory/config.go | 7 ------- 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/internal/util/nf_authorization.go b/internal/util/nf_authorization.go index 7397975..0f6def5 100644 --- a/internal/util/nf_authorization.go +++ b/internal/util/nf_authorization.go @@ -7,12 +7,11 @@ import ( "github.com/free5gc/openapi/oauth" udm_context "github.com/free5gc/udm/internal/context" - "github.com/free5gc/udm/pkg/factory" ) // This function would check the OAuth2 token, and the requestNF is in ServiceAllowNfType func AuthorizationCheck(c *gin.Context, serviceName string) error { - if factory.UdmConfig.GetOAuth() { + if udm_context.GetSelf().OAuth2Required { oauth_err := oauth.VerifyOAuth(c.Request.Header.Get("Authorization"), serviceName, udm_context.GetSelf().NrfCerPem) if oauth_err != nil { diff --git a/pkg/factory/config.go b/pkg/factory/config.go index edc3f24..58b1a96 100644 --- a/pkg/factory/config.go +++ b/pkg/factory/config.go @@ -136,13 +136,6 @@ type Sbi struct { BindingIPv4 string `yaml:"bindingIPv4,omitempty" valid:"host,required"` // IP used to run the server in the node. Port int `yaml:"port,omitempty" valid:"port,required"` Tls *Tls `yaml:"tls,omitempty" valid:"optional"` - OAuth bool `yaml:"oauth,omitempty" valid:"optional"` -} - -func (c *Config) GetOAuth() bool { - c.RLock() - defer c.RUnlock() - return c.Configuration.Sbi.OAuth } func (s *Sbi) validate() (bool, error) {