File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -95,7 +95,12 @@ func refreshCmd() *cobra.Command {
9595 return cmd
9696}
9797
98+ type whoAmICmdFlags struct {
99+ showTokens bool
100+ }
101+
98102func whoAmICmd () * cobra.Command {
103+ flags := & whoAmICmdFlags {}
99104 cmd := & cobra.Command {
100105 Use : "whoami" ,
101106 Short : "Show the current user" ,
@@ -127,10 +132,24 @@ func whoAmICmd() *cobra.Command {
127132 fmt .Fprintf (cmd .OutOrStdout (), "Name: %s\n " , idClaims .Name )
128133 }
129134
135+ if flags .showTokens {
136+ fmt .Fprintf (cmd .OutOrStdout (), "Access Token: %s\n " , tok .AccessToken )
137+ fmt .Fprintf (cmd .OutOrStdout (), "ID Token: %s\n " , tok .IDToken )
138+ fmt .Fprintf (cmd .OutOrStdout (), "Refresh Token: %s\n " , tok .RefreshToken )
139+
140+ }
141+
130142 return nil
131143 },
132144 }
133145
146+ cmd .Flags ().BoolVar (
147+ & flags .showTokens ,
148+ "show-tokens" ,
149+ false ,
150+ "Show the access, id, and refresh tokens" ,
151+ )
152+
134153 return cmd
135154}
136155
You can’t perform that action at this time.
0 commit comments