Last active
December 20, 2024 12:07
-
-
Save chrigl/48430fef50c6efd1e2e8db2318ecb9aa to your computer and use it in GitHub Desktop.
arrow-of-death.go
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| serviceAccountName := "" | |
| if claims, ok := jwtToken.Claims.(jwt.MapClaims); ok { | |
| for key, value := range claims { | |
| if key == "kubernetes.io" { | |
| if k8sClaims, ok := value.(map[string]interface{}); ok { | |
| for k, v := range k8sClaims { | |
| if k == "serviceaccount" { | |
| if saClaims, ok := v.(map[string]interface{}); ok { | |
| for k, v := range saClaims { | |
| if k == "name" { | |
| if name, ok := v.(string); ok { | |
| serviceAccountName = name | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment