Documentation
¶
Overview ¶
Package auth provides the auth command project for the minder CLI.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var AuthCmd = &cobra.Command{ Use: "auth", Short: "Authorize and manage accounts within a minder control plane", Long: `The minder auth command project lets you create accounts and grant or revoke authorization to existing accounts within a minder control plane.`, RunE: func(cmd *cobra.Command, args []string) error { return cmd.Usage() }, }
AuthCmd represents the account command
View Source
var Auth_revokeproviderCmd = &cobra.Command{ Use: "revoke_provider", Short: "Revoke access tokens for provider", Long: `It can revoke access tokens for specific provider.`, PreRun: func(cmd *cobra.Command, args []string) { if err := viper.BindPFlags(cmd.Flags()); err != nil { fmt.Fprintf(os.Stderr, "Error binding flags: %s\n", err) } }, Run: func(cmd *cobra.Command, args []string) { all := util.GetConfigValue(viper.GetViper(), "all", "all", cmd, false).(bool) project := viper.GetString("project-id") provider := util.GetConfigValue(viper.GetViper(), "provider", "provider", cmd, "").(string) if all && project != "" { fmt.Fprintf(os.Stderr, "Error: you can't use --all and --project-id together\n") os.Exit(1) } if all { yes := cli.PrintYesNoPrompt(cmd, "Are you sure you want to revoke all access tokens for your provider? (yes/no): ", "Delete provider access tokens cancelled.") if !yes { return } } conn, err := util.GrpcForCommand(cmd, viper.GetViper()) util.ExitNicelyOnError(err, "Error getting grpc connection") defer conn.Close() ctx, cancel := util.GetAppContext() defer cancel() client := pb.NewOAuthServiceClient(conn) if all { result, err := client.RevokeOauthTokens(ctx, &pb.RevokeOauthTokensRequest{}) util.ExitNicelyOnError(err, "Error revoking tokens") cmd.Println("Revoked a total of ", result.RevokedTokens, " tokens") } else { _, err := client.RevokeOauthProjectToken(ctx, &pb.RevokeOauthProjectTokenRequest{Provider: provider, ProjectId: project}) util.ExitNicelyOnError(err, "Error revoking tokens") if project == "" { cmd.Println("Revoked token for default project") } else { cmd.Println("Revoked token for project ", project) } } }, }
Auth_revokeproviderCmd represents the auth revoke command
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.