1818package cmd
1919
2020import (
21- "fmt"
22- "strings"
23-
24- "github.com/charmbracelet/lipgloss"
2521 "github.com/minio/cli"
26- json "github.com/minio/colorjson"
2722 "github.com/minio/madmin-go"
28- "github.com/minio/mc/pkg/probe"
2923)
3024
3125var adminIDPInfoCmd = cli.Command {
@@ -34,6 +28,7 @@ var adminIDPInfoCmd = cli.Command{
3428 Before : setGlobalsFromContext ,
3529 Action : mainAdminIDPGet ,
3630 OnUsageError : onUsageError ,
31+ Hidden : true ,
3732 Flags : globalFlags ,
3833 CustomHelpTemplate : `NAME:
3934 {{.HelpName}} - {{.Usage}}
4338
4439 ID_TYPE must be one of 'ldap' or 'openid'.
4540
41+ **DEPRECATED**: This command will be removed in a future version. Please use
42+ "mc admin idp ldap|openid" instead.
43+
4644FLAGS:
4745 {{range .VisibleFlags}}{{.}}
4846 {{end}}
@@ -62,78 +60,14 @@ func mainAdminIDPGet(ctx *cli.Context) error {
6260 }
6361
6462 args := ctx .Args ()
65- aliasedURL := args .Get (0 )
66-
67- // Create a new MinIO Admin Client
68- client , err := newAdminClient (aliasedURL )
69- fatalIf (err , "Unable to initialize admin connection." )
70-
7163 idpType := args .Get (1 )
7264 validateIDType (idpType )
65+ isOpenID := idpType == madmin .OpenidIDPCfg
7366
7467 var cfgName string
7568 if len (args ) == 3 {
7669 cfgName = args .Get (2 )
7770 }
7871
79- result , e := client .GetIDPConfig (globalContext , idpType , cfgName )
80- fatalIf (probe .NewError (e ), "Unable to get IDP config for '%s' to server" , idpType )
81-
82- // Print set config result
83- printMsg (idpConfig (result ))
84-
85- return nil
86- }
87-
88- type idpConfig madmin.IDPConfig
89-
90- func (i idpConfig ) JSON () string {
91- bs , e := json .MarshalIndent (i , "" , " " )
92- fatalIf (probe .NewError (e ), "Unable to marshal into JSON." )
93-
94- return string (bs )
95- }
96-
97- func (i idpConfig ) String () string {
98- // Determine required width for key column.
99- fieldColWidth := 0
100- for _ , kv := range i .Info {
101- if fieldColWidth < len (kv .Key ) {
102- fieldColWidth = len (kv .Key )
103- }
104- }
105- // Add 1 for the colon-suffix in each entry.
106- fieldColWidth ++
107-
108- fieldColStyle := lipgloss .NewStyle ().
109- Width (fieldColWidth ).
110- Foreground (lipgloss .Color ("#04B575" )). // green
111- Bold (true ).
112- Align (lipgloss .Right )
113- valueColStyle := lipgloss .NewStyle ().
114- PaddingLeft (1 ).
115- Align (lipgloss .Left )
116- envMarkStyle := lipgloss .NewStyle ().
117- Foreground (lipgloss .Color ("201" )). // pinkish-red
118- PaddingLeft (1 )
119-
120- var lines []string
121- for _ , kv := range i .Info {
122- envStr := ""
123- if kv .IsCfg && kv .IsEnv {
124- envStr = " (environment)"
125- }
126- lines = append (lines , fmt .Sprintf ("%s%s%s" ,
127- fieldColStyle .Render (kv .Key + ":" ),
128- valueColStyle .Render (kv .Value ),
129- envMarkStyle .Render (envStr ),
130- ))
131- }
132-
133- boxContent := strings .Join (lines , "\n " )
134-
135- boxStyle := lipgloss .NewStyle ().
136- BorderStyle (lipgloss .RoundedBorder ())
137-
138- return boxStyle .Render (boxContent )
72+ return adminIDPInfo (ctx , isOpenID , cfgName )
13973}
0 commit comments