(client *management.Client, t *authutil.TokenResponse)
| 32 | } |
| 33 | |
| 34 | func (r *Renderer) TestToken(client *management.Client, t *authutil.TokenResponse) { |
| 35 | r.Heading(fmt.Sprintf("token for %s", ansi.Bold(client.GetName()))) |
| 36 | |
| 37 | switch r.Format { |
| 38 | case OutputFormatJSON: |
| 39 | r.JSONResult(t) |
| 40 | case OutputFormatJSONCompact: |
| 41 | r.JSONCompactResult(t) |
| 42 | default: |
| 43 | if t.TokenType != "" { |
| 44 | r.Output(" TOKEN TYPE " + t.TokenType) |
| 45 | r.Newline() |
| 46 | } |
| 47 | if t.ExpiresIn != 0 { |
| 48 | r.Output(" EXPIRES IN " + strconv.FormatInt(t.ExpiresIn/60, 10) + " minute(s)") |
| 49 | r.Newline() |
| 50 | } |
| 51 | if t.RefreshToken != "" { |
| 52 | r.Output(" REFRESH TOKEN " + t.RefreshToken) |
| 53 | r.Newline() |
| 54 | } |
| 55 | if t.IDToken != "" { |
| 56 | r.Output(" ID TOKEN " + t.IDToken) |
| 57 | r.Newline() |
| 58 | } |
| 59 | if t.AccessToken != "" { |
| 60 | r.Output(" ACCESS TOKEN " + t.AccessToken) |
| 61 | r.Newline() |
| 62 | } |
| 63 | } |
| 64 | } |
no test coverage detected