Commit 8724cca5 authored by Dave Grijalva's avatar Dave Grijalva

debug flag

parent e066f616
...@@ -22,6 +22,7 @@ var ( ...@@ -22,6 +22,7 @@ var (
flagAlg = flag.String("alg", "", "signing algorithm identifier") flagAlg = flag.String("alg", "", "signing algorithm identifier")
flagKey = flag.String("key", "", "path to key file or '-' to read from stdin") flagKey = flag.String("key", "", "path to key file or '-' to read from stdin")
flagPretty = flag.Bool("pretty", true, "output pretty JSON") 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 // Modes - exactly one of these is required
flagSign = flag.String("sign", "", "path to claims object to sign or '-' to read from stdin") flagSign = flag.String("sign", "", "path to claims object to sign or '-' to read from stdin")
...@@ -94,6 +95,12 @@ func verifyToken() error { ...@@ -94,6 +95,12 @@ func verifyToken() error {
return loadData(*flagKey) 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 // Print an error if we can't parse for some reason
if err != nil { if err != nil {
return fmt.Errorf("Couldn't parse token: %v", err) return fmt.Errorf("Couldn't parse token: %v", err)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment