From c32b6154308036c9e6a974ce1a864060e14e7587 Mon Sep 17 00:00:00 2001 From: kun Date: Wed, 21 Aug 2024 05:29:30 +0000 Subject: [PATCH] fix: confict & golangci error --- go.mod | 2 +- internal/sbi/processor/access_token.go | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/go.mod b/go.mod index 37f6fd3..f0cdc4c 100644 --- a/go.mod +++ b/go.mod @@ -12,7 +12,7 @@ require ( github.com/mitchellh/mapstructure v1.4.2 github.com/pkg/errors v0.9.1 github.com/sirupsen/logrus v1.9.3 - github.com/stretchr/testify v1.8.3 + github.com/stretchr/testify v1.8.4 github.com/urfave/cli v1.22.5 go.mongodb.org/mongo-driver v1.8.4 gopkg.in/yaml.v2 v2.4.0 diff --git a/internal/sbi/processor/access_token.go b/internal/sbi/processor/access_token.go index 6dad316..e0e1938 100644 --- a/internal/sbi/processor/access_token.go +++ b/internal/sbi/processor/access_token.go @@ -53,7 +53,7 @@ func (p *Processor) AccessTokenProcedure(request models.NrfAccessTokenAccessToke ) scope := request.Scope now := time.Now() - nowNum := int32(now.Unix()) + // nowNum := int32(now.Unix()) errResponse := p.AccessTokenScopeCheck(request) if errResponse != nil { @@ -64,15 +64,15 @@ func (p *Processor) AccessTokenProcedure(request models.NrfAccessTokenAccessToke // Create AccessToken nrfCtx := nrf_context.GetSelf() accessTokenClaims := models.AccessTokenClaims{ - Iss: nrfCtx.Nrf_NfInstanceID, // NF instance id of the NRF - Sub: request.NfInstanceId, // nfInstanceId of service consumer - Aud: request.TargetNfInstanceId, // nfInstanceId of service producer - Scope: request.Scope, // TODO: the name of the NF services for which the - Exp: now + expiration, // access_token is authorized for use + Iss: nrfCtx.Nrf_NfInstanceID, // NF instance id of the NRF + Sub: request.NfInstanceId, // nfInstanceId of service consumer + Aud: request.TargetNfInstanceId, // nfInstanceId of service producer + Scope: request.Scope, // TODO: the name of the NF services for which the + Exp: int32(now.Unix()) + expiration, // access_token is authorized for use RegisteredClaims: jwt.RegisteredClaims{}, } - accessTokenClaims.IssuedAt = &jwt.NumericDate{Time: time.Unix(int64(now), 0)} + accessTokenClaims.IssuedAt = jwt.NewNumericDate(now) // Use NRF private key to sign AccessToken token := jwt.NewWithClaims(jwt.GetSigningMethod("RS512"), accessTokenClaims)