MCPcopy
hub / github.com/cloudfoundry/cli / Execute

Method Execute

cf/commands/auth.go:61–81  ·  view source on GitHub ↗
(c flags.FlagContext)

Source from the content-addressed store, hash-verified

59}
60
61func (cmd *Authenticate) Execute(c flags.FlagContext) error {
62 cmd.config.ClearSession()
63 cmd.authenticator.GetLoginPromptsAndSaveUAAServerURL()
64
65 cmd.ui.Say(T("API endpoint: {{.APIEndpoint}}",
66 map[string]interface{}{"APIEndpoint": terminal.EntityNameColor(cmd.config.APIEndpoint())}))
67 cmd.ui.Say(T("Authenticating..."))
68
69 err := cmd.authenticator.Authenticate(map[string]string{"username": c.Args()[0], "password": c.Args()[1]})
70 if err != nil {
71 return err
72 }
73
74 cmd.ui.Ok()
75 cmd.ui.Say(T("Use '{{.Name}}' to view or set your target org and space",
76 map[string]interface{}{"Name": terminal.CommandColor(cf.Name + " target")}))
77
78 cmd.ui.NotifyUpdateIfNeeded(cmd.config)
79
80 return nil
81}

Callers

nothing calls this directly

Calls 10

EntityNameColorFunction · 0.92
CommandColorFunction · 0.92
ClearSessionMethod · 0.65
SayMethod · 0.65
APIEndpointMethod · 0.65
AuthenticateMethod · 0.65
ArgsMethod · 0.65
OkMethod · 0.65
NotifyUpdateIfNeededMethod · 0.65

Tested by

no test coverage detected