Skip to content

Commit 9fc5de8

Browse files
committed
Debugging
1 parent 3eef933 commit 9fc5de8

File tree

1 file changed

+17
-0
lines changed
  • backend/internal/services

1 file changed

+17
-0
lines changed

backend/internal/services/s3.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,12 @@ package services
22

33
import (
44
"context"
5+
"encoding/base64"
6+
"encoding/json"
57
"fmt"
68
"io"
9+
"log/slog"
10+
"strings"
711

812
"cloud.google.com/go/compute/metadata"
913
"github.com/aws/aws-sdk-go-v2/aws"
@@ -35,6 +39,19 @@ func (t gcpTokenFetcher) GetIdentityToken() ([]byte, error) {
3539
if err != nil {
3640
return nil, fmt.Errorf("failed to get identity token from metadata server: %w", err)
3741
}
42+
43+
// Debug: decode and log JWT claims
44+
parts := strings.Split(token, ".")
45+
if len(parts) == 3 {
46+
payload, err := base64.RawURLEncoding.DecodeString(parts[1])
47+
if err == nil {
48+
var claims map[string]interface{}
49+
if json.Unmarshal(payload, &claims) == nil {
50+
slog.Info("OIDC token claims", "aud", claims["aud"], "iss", claims["iss"], "sub", claims["sub"], "email", claims["email"])
51+
}
52+
}
53+
}
54+
3855
return []byte(token), nil
3956
}
4057

0 commit comments

Comments
 (0)