From ac5d64f2bbdeebedded9e29336d28955a7c42000 Mon Sep 17 00:00:00 2001 From: ecrupper Date: Fri, 28 Jun 2024 16:06:19 -0500 Subject: [PATCH] enhance(token): add info logging on created private key, debug for minted ID token --- internal/token/generate_rsa.go | 3 +++ internal/token/mint.go | 3 +++ 2 files changed, 6 insertions(+) diff --git a/internal/token/generate_rsa.go b/internal/token/generate_rsa.go index fae46aef2..483f0074f 100644 --- a/internal/token/generate_rsa.go +++ b/internal/token/generate_rsa.go @@ -10,6 +10,7 @@ import ( "github.com/google/uuid" "github.com/lestrrat-go/jwx/v2/jwk" + "github.com/sirupsen/logrus" "github.com/go-vela/server/database" ) @@ -54,6 +55,8 @@ func (tm *Manager) GenerateRSA(ctx context.Context, db database.Interface) error tm.RSAKeySet = keySet + logrus.Infof("generated RSA key pair with kid %s", kid.String()) + return nil default: return fmt.Errorf("invalid JWK type parsed from generation") diff --git a/internal/token/mint.go b/internal/token/mint.go index 1cbb65663..c86757b07 100644 --- a/internal/token/mint.go +++ b/internal/token/mint.go @@ -9,6 +9,7 @@ import ( "time" "github.com/golang-jwt/jwt/v5" + "github.com/sirupsen/logrus" "gorm.io/gorm" api "github.com/go-vela/server/api/types" @@ -196,5 +197,7 @@ func (tm *Manager) MintIDToken(ctx context.Context, mto *MintTokenOpts, db datab return "", fmt.Errorf("unable to sign token: %w", err) } + logrus.Debugf("signed ID token with subject %s", claims.Subject) + return token, nil }