Skip to content

Commit

Permalink
Merge pull request #35 from andy89923/fix/oauth-gen-cert
Browse files Browse the repository at this point in the history
Fix: fix nil pointer when generate new key
  • Loading branch information
ianchen0119 authored Mar 8, 2024
2 parents a2ffd61 + 0c73fb3 commit f51040b
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 f51040b

Please sign in to comment.