From 8724cca5ea67dbe5fca0eaa722614826f0bbb47d Mon Sep 17 00:00:00 2001 From: Dave Grijalva Date: Mon, 19 May 2014 22:19:42 -0700 Subject: [PATCH] debug flag --- cmd/jwt/app.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/cmd/jwt/app.go b/cmd/jwt/app.go index fdefe98..70f82ed 100644 --- a/cmd/jwt/app.go +++ b/cmd/jwt/app.go @@ -22,6 +22,7 @@ var ( flagAlg = flag.String("alg", "", "signing algorithm identifier") flagKey = flag.String("key", "", "path to key file or '-' to read from stdin") flagPretty = flag.Bool("pretty", true, "output pretty JSON") + flagDebug = flag.Bool("debug", false, "print out all kinds of debug data") // Modes - exactly one of these is required flagSign = flag.String("sign", "", "path to claims object to sign or '-' to read from stdin") @@ -94,6 +95,12 @@ func verifyToken() error { return loadData(*flagKey) }) + // Print some debug data + if *flagDebug && token != nil { + fmt.Printf("Header:\n%v\n", token.Header) + fmt.Printf("Claims:\n%v\n", token.Claims) + } + // Print an error if we can't parse for some reason if err != nil { return fmt.Errorf("Couldn't parse token: %v", err)