Skip to content

Commit

Permalink
Fix: fix nil pointer when generate new key
Browse files Browse the repository at this point in the history
  • Loading branch information
andy89923 committed Mar 7, 2024
1 parent 21c6656 commit 0c73fb3
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions internal/context/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,10 @@ func SignNFCert(nfType, nfId string) error {
if err != nil {
return errors.Wrapf(err, "Generate Error")
}
nfPubKey, err = oauth.ParsePublicKeyFromPEM(nfCertPath)
if err != nil {
return errors.Wrapf(err, "Generated but can't parse public key")
}
}

// Generate new NF's Certificate to new file
Expand Down Expand Up @@ -191,6 +195,7 @@ func (context *NRFContext) AuthorizationCheck(token, serviceName string) error {
}
err := oauth.VerifyOAuth(token, serviceName, factory.NrfConfig.GetNrfCertPemPath())
if err != nil {
logger.AccTokenLog.Warningln("AuthorizationCheck:", err)
return err
}
return nil
Expand Down

0 comments on commit 0c73fb3

Please sign in to comment.