Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions pkg/nodeauth/jwt/node_jwt_authenticator.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package jwt
import (
"context"
"crypto/ed25519"
"encoding/hex"
"fmt"
"log/slog"

Expand Down Expand Up @@ -62,21 +63,21 @@ func (v *NodeJWTAuthenticator) AuthenticateJWT(ctx context.Context, tokenString
isValid, err := v.nodeAuthProvider.IsNodePubKeyTrusted(ctx, publicKey)
if err != nil {
v.logger.Error("Node validation failed",
"csaPubKey", publicKey,
"csaPubKey", hex.EncodeToString(publicKey),
"error", err,
)
return false, claims, fmt.Errorf("node validation failed: %w", err)
}

if !isValid {
v.logger.Warn("Unauthorized node attempted access",
"csaPubKey", publicKey,
"csaPubKey", hex.EncodeToString(publicKey),
)
return false, claims, fmt.Errorf("unauthorized node: %s", publicKey)
return false, claims, fmt.Errorf("unauthorized node: %s", hex.EncodeToString(publicKey))
}

v.logger.Debug("JWT validation successful",
"csaPubKey", publicKey,
"csaPubKey", hex.EncodeToString(publicKey),
)

return true, claims, nil
Expand Down
Loading