MCPcopy Index your code
hub / github.com/smallstep/cli / Validate

Method Validate

command/oauth/cmd.go:330–349  ·  view source on GitHub ↗

Validate validates the options.

()

Source from the content-addressed store, hash-verified

328
329// Validate validates the options.
330func (o *options) Validate() error {
331 if o.Provider != "google" && o.Provider != "github" && !strings.HasPrefix(o.Provider, "https://") {
332 return errors.New("use a valid provider: google or github")
333 }
334 if o.CallbackListener != "" {
335 if _, _, err := net.SplitHostPort(o.CallbackListener); err != nil {
336 return errors.Wrapf(err, "invalid value '%s' for flag '--listen'", o.CallbackListener)
337 }
338 }
339 if o.CallbackListenerURL != "" {
340 u, err := url.Parse(o.CallbackListenerURL)
341 if err != nil || u.Scheme == "" {
342 return errors.Wrapf(err, "invalid value '%s' for flag '--listen-url'", o.CallbackListenerURL)
343 }
344 if u.Path != "" {
345 o.CallbackPath = u.Path
346 }
347 }
348 return nil
349}
350
351func oauthCmd(c *cli.Context) error {
352 opts := &options{

Callers 3

oauthCmdFunction · 0.95
readExistingUUIDFunction · 0.80
createActionFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected