Skip to content

Commit

Permalink
rename to auth0 -> legacy, and kas -> nvidia, still defaults to legacy
Browse files Browse the repository at this point in the history
  • Loading branch information
theFong committed Nov 15, 2024
1 parent 79457bc commit 34609cf
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions pkg/cmd/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,15 +68,15 @@ var (

func init() {
flag.StringVar(&emailFlag, "email", "", "email to use for authentication")
flag.StringVar(&authProviderFlag, "auth", "", "authentication provider to use (auth0 or kas, default is auth0)")
flag.StringVar(&authProviderFlag, "auth", "", "authentication provider to use (nvidia or legacy, default is legacy)")
flag.Parse()
}

func NewDefaultBrevCommand() *cobra.Command {
cmd := NewBrevCommand()
cmd.PersistentFlags().StringVar(&userFlag, "user", "", "non root user to use for per user configuration of commands run as root")
cmd.PersistentFlags().StringVar(&emailFlag, "email", "", "email to use for authentication")
cmd.PersistentFlags().StringVar(&authProviderFlag, "auth", "", "authentication provider to use (auth0 or kas, default is auth0)")
cmd.PersistentFlags().StringVar(&authProviderFlag, "auth", "", "authentication provider to use (nvidia or legacy, default is legacy)")
return cmd
}

Expand Down Expand Up @@ -138,7 +138,8 @@ func NewBrevCommand() *cobra.Command { //nolint:funlen,gocognit,gocyclo // defin
}

if authProviderFlag != "" {
authenticatorByProviderFlag, errr := authRetriever.GetByProvider(entity.CredentialProvider(authProviderFlag))
provider := authProviderFlagToCredentialProvider(authProviderFlag)
authenticatorByProviderFlag, errr := authRetriever.GetByProvider(provider)
if errr != nil {
fmt.Printf("%v\n", errr)
} else {
Expand Down Expand Up @@ -536,3 +537,13 @@ var (
_ store.Auth = auth.NoLoginAuth{}
_ auth.AuthStore = store.FileStore{}
)

func authProviderFlagToCredentialProvider(authProviderFlag string) entity.CredentialProvider {
if authProviderFlag == "" {
return ""
}
if authProviderFlag == "nvidia" {
return auth.CredentialProviderKAS
}
return auth.CredentialProviderAuth0
}

0 comments on commit 34609cf

Please sign in to comment.