Skip to content

Commit

Permalink
enhance(token): add info logging on created private key, debug for mi…
Browse files Browse the repository at this point in the history
…nted ID token
  • Loading branch information
ecrupper committed Jun 28, 2024
1 parent b24411e commit ac5d64f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions internal/token/generate_rsa.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand Down Expand Up @@ -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")
Expand Down
3 changes: 3 additions & 0 deletions internal/token/mint.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
}

0 comments on commit ac5d64f

Please sign in to comment.