diff --git a/go.mod b/go.mod index 7f785c370..e61e9511d 100644 --- a/go.mod +++ b/go.mod @@ -13,7 +13,6 @@ require ( github.com/google/go-cmp v0.5.9 github.com/google/uuid v1.3.0 github.com/guiguan/caster v0.0.0-20191104051807-3736c4464f38 - github.com/joeshaw/envdecode v0.0.0-20200121155833-099f1fc765bd github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 github.com/lestrrat-go/jwx v1.2.25 github.com/logrusorgru/aurora v2.0.3+incompatible diff --git a/go.sum b/go.sum index 733beb600..618b653bd 100644 --- a/go.sum +++ b/go.sum @@ -80,8 +80,6 @@ github.com/hinshun/vt10x v0.0.0-20220119200601-820417d04eec h1:qv2VnGeEQHchGaZ/u github.com/hinshun/vt10x v0.0.0-20220119200601-820417d04eec/go.mod h1:Q48J4R4DvxnHolD5P8pOtXigYlRuPLGl6moFx3ulM68= github.com/inconshreveable/mousetrap v1.0.1 h1:U3uMjPSQEBMNp1lFxmllqCPM6P5u/Xq7Pgzkat/bFNc= github.com/inconshreveable/mousetrap v1.0.1/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= -github.com/joeshaw/envdecode v0.0.0-20200121155833-099f1fc765bd h1:nIzoSW6OhhppWLm4yqBwZsKJlAayUu5FGozhrF3ETSM= -github.com/joeshaw/envdecode v0.0.0-20200121155833-099f1fc765bd/go.mod h1:MEQrHur0g8VplbLOv5vXmDzacSaH9Z7XhcgsSh1xciU= github.com/joho/godotenv v1.4.0 h1:3l4+N6zfMWnkbPEXKng2o2/MR5mSwTrBih4ZEkkz1lg= github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 h1:Z9n2FFNUXsshfwJMBgNA0RU6/i7WVaAegv3PtuIHPMs= github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51/go.mod h1:CzGEWj7cYgsdH8dAjBGEr58BoE7ScuLd+fwFZ44+/x8= diff --git a/internal/auth/auth.go b/internal/auth/auth.go index 9955fe8e3..6a5a82ef6 100644 --- a/internal/auth/auth.go +++ b/internal/auth/auth.go @@ -13,7 +13,6 @@ import ( "strings" "time" - "github.com/joeshaw/envdecode" "golang.org/x/oauth2/clientcredentials" ) @@ -74,10 +73,10 @@ var requiredScopes = []string{ // Authenticator is used to facilitate the login process. type Authenticator struct { - Audience string `env:"AUTH0_AUDIENCE,default=https://*.auth0.com/api/v2/"` - ClientID string `env:"AUTH0_CLIENT_ID,default=2iZo3Uczt5LFHacKdM0zzgUO2eG2uDjT"` - DeviceCodeEndpoint string `env:"AUTH0_DEVICE_CODE_ENDPOINT,default=https://auth0.auth0.com/oauth/device/code"` - OauthTokenEndpoint string `env:"AUTH0_OAUTH_TOKEN_ENDPOINT,default=https://auth0.auth0.com/oauth/token"` + Audience string + ClientID string + DeviceCodeEndpoint string + OauthTokenEndpoint string } // SecretStore provides access to stored sensitive data. @@ -124,16 +123,14 @@ func (s *State) IntervalDuration() time.Duration { return time.Duration(s.Interval+waitThresholdInSeconds) * time.Second } -// New returns a new instance of Authenticator -// after decoding its parameters from env vars. -func New() (*Authenticator, error) { - authenticator := Authenticator{} - - if err := envdecode.StrictDecode(&authenticator); err != nil { - return nil, fmt.Errorf("failed to decode env vars for authenticator: %w", err) +// New returns a new instance of Authenticator using Auth0 Public Cloud default values +func New() *Authenticator { + return &Authenticator{ + Audience: "https://*.auth0.com/api/v2/", + ClientID: "2iZo3Uczt5LFHacKdM0zzgUO2eG2uDjT", + DeviceCodeEndpoint: "https://auth0.auth0.com/oauth/device/code", + OauthTokenEndpoint: "https://auth0.auth0.com/oauth/token", } - - return &authenticator, nil } // Start kicks-off the device authentication flow by requesting diff --git a/internal/cli/root.go b/internal/cli/root.go index 120bd1207..218d62336 100644 --- a/internal/cli/root.go +++ b/internal/cli/root.go @@ -21,11 +21,6 @@ const rootShort = "Supercharge your development workflow." // Execute is the primary entrypoint of the CLI app. func Execute() { - // cfg contains tenant related information, e.g. `travel0-dev`, - // `travel0-prod`. some of its information can be sourced via: - // 1. env var (e.g. AUTH0_API_KEY) - // 2. global flag (e.g. --api-key) - // 3. JSON file (e.g. api_key = "..." in ~/.config/auth0/config.json) cli := &cli{ renderer: display.NewRenderer(), tracker: analytics.NewTracker(), @@ -85,11 +80,7 @@ func buildRootCmd(cli *cli) *cobra.Command { Long: rootShort + "\n" + getLogin(cli), Version: buildinfo.GetVersionWithCommit(), PersistentPreRunE: func(cmd *cobra.Command, args []string) error { - var err error - cli.authenticator, err = auth.New() - if err != nil { - return err - } + cli.authenticator = auth.New() ansi.DisableColors = cli.noColor prepareInteractivity(cmd)