diff --git a/internal/cli/clients_test.go b/internal/cli/clients_test.go index 9157c12f6..1ca3c295c 100644 --- a/internal/cli/clients_test.go +++ b/internal/cli/clients_test.go @@ -49,9 +49,9 @@ func TestClientsListCmd(t *testing.T) { } expectTable(t, stdout.String(), - []string{"NAME", "TYPE", "CLIENT ID", "CALLBACKS"}, + []string{"NAME", "TYPE", "CLIENT ID"}, [][]string{ - {"some-name", "generic", "some-id", "http://localhost"}, + {"some-name", "generic", "some-id"}, }, ) } diff --git a/internal/display/clients.go b/internal/display/clients.go index 25391fcb1..8e33ca34e 100644 --- a/internal/display/clients.go +++ b/internal/display/clients.go @@ -53,6 +53,41 @@ func (v *clientView) AsTableRow() []string { } +// listClientView is a slimmed down view of a client for displaying +// larger numbers of clients +type listClientView struct { + Name string + Type string + ClientID string + ClientSecret string + revealSecret bool +} + +func (v *listClientView) AsTableHeader() []string { + if v.revealSecret { + return []string{"Name", "Type", "ClientID", "Client Secret"} + } + return []string{"Name", "Type", "Client ID"} + +} + +func (v *listClientView) AsTableRow() []string { + if v.revealSecret { + return []string{ + v.Name, + v.Type, + ansi.Faint(v.ClientID), + ansi.Italic(v.ClientSecret), + } + } + return []string{ + v.Name, + v.Type, + ansi.Faint(v.ClientID), + } + +} + func (r *Renderer) ClientList(clients []*management.Client) { r.Heading(ansi.Bold(r.Tenant), "clients\n") var res []View @@ -60,12 +95,11 @@ func (r *Renderer) ClientList(clients []*management.Client) { if auth0.StringValue(c.Name) == deprecatedAppName { continue } - res = append(res, &clientView{ + res = append(res, &listClientView{ Name: auth0.StringValue(c.Name), Type: appTypeFor(c.AppType), ClientID: auth0.StringValue(c.ClientID), ClientSecret: auth0.StringValue(c.ClientSecret), - Callbacks: callbacksFor(c.Callbacks), }) }