Skip to content

Commit

Permalink
Merge pull request #103 from allcloud-io/feature/update-dependencies
Browse files Browse the repository at this point in the history
Update dependencies & KeyChain support on Windows
  • Loading branch information
Jonathan authored Feb 11, 2021
2 parents 3fa87d5 + 1a43dad commit bcaab7a
Show file tree
Hide file tree
Showing 7 changed files with 324 additions and 105 deletions.
6 changes: 1 addition & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,6 @@ build:
test:
$(GOCMD) test -v ./...

.PHONY: darwin-386
darwin-386:
GOOS=darwin GOARCH=386 $(GOBUILD) -ldflags "-X main.version=$(VERSION)" -o $(BINARY_NAME)-darwin-386 -v

.PHONY: darwin-amd64
darwin-amd64:
GOOS=darwin GOARCH=amd64 $(GOBUILD) -ldflags "-X main.version=$(VERSION)" -o $(BINARY_NAME)-darwin-amd64 -v
Expand All @@ -37,7 +33,7 @@ windows-amd64:
GOOS=windows GOARCH=amd64 $(GOBUILD) -ldflags "-X main.version=$(VERSION)" -o $(BINARY_NAME)-windows-amd64.exe -v

.PHONY: all
all: darwin-386 darwin-amd64 linux-386 linux-amd64 windows-386 windows-amd64
all: darwin-amd64 linux-386 linux-amd64 windows-386 windows-amd64

.PHONY: zip
zip:
Expand Down
5 changes: 3 additions & 2 deletions cmd/providers.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@ import (
"log"
"sort"
"strconv"
"syscall"

"github.com/allcloud-io/clisso/keychain"
"github.com/fatih/color"
"github.com/howeyc/gopass"
"github.com/spf13/cobra"
"github.com/spf13/viper"
"golang.org/x/term"
)

// OneLogin
Expand Down Expand Up @@ -97,7 +98,7 @@ var cmdProvidersPassword = &cobra.Command{
Run: func(cmd *cobra.Command, args []string) {
provider := args[0]
fmt.Printf("Please enter the password for the '%s' provider: ", provider)
pass, err := gopass.GetPasswd()
pass, err := term.ReadPassword(syscall.Stdin)
if err != nil {
log.Fatalf(color.RedString("Could not read password"))
}
Expand Down
30 changes: 10 additions & 20 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,32 +4,22 @@ go 1.12

require (
github.com/PuerkitoBio/goquery v1.5.0
github.com/aws/aws-sdk-go v1.20.6
github.com/briandowns/spinner v0.0.0-20190319032542-ac46072a5a91
github.com/dgrijalva/jwt-go v3.2.0+incompatible // indirect
github.com/aws/aws-sdk-go v1.37.8
github.com/briandowns/spinner v1.12.0
github.com/challarao/keyring v0.0.0-20190721191509-6be0d53230e3
github.com/edaniels/go-saml v0.0.0-20160724042625-8c877c3ab101
github.com/fatih/color v1.7.0
github.com/go-ini/ini v1.42.0
github.com/fatih/color v1.10.0
github.com/go-ini/ini v1.62.0
github.com/guelfey/go.dbus v0.0.0-20131113121618-f6a3a2366cc3 // indirect
github.com/howeyc/gopass v0.0.0-20170109162249-bf9dde6d0d2c
github.com/kr/pretty v0.2.0 // indirect
github.com/magiconair/properties v1.8.1 // indirect
github.com/mattn/go-colorable v0.1.2
github.com/mattn/go-colorable v0.1.8
github.com/mitchellh/go-homedir v1.1.0
github.com/olekukonko/tablewriter v0.0.4
github.com/pelletier/go-toml v1.4.0 // indirect
github.com/smartystreets/goconvey v1.6.4 // indirect
github.com/spf13/afero v1.2.2 // indirect
github.com/spf13/cobra v0.0.4
github.com/spf13/cobra v1.1.2
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/spf13/viper v1.3.2
github.com/stretchr/testify v1.6.1 // indirect
github.com/tmc/keyring v0.0.0-20171121202319-839169085ae1
golang.org/x/crypto v0.0.0-20190513172903-22d7a77e9e5f // indirect
golang.org/x/net v0.0.0-20190620200207-3b0461eec859
golang.org/x/sys v0.0.0-20190516110030-61b9204099cb // indirect
golang.org/x/text v0.3.2 // indirect
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect
github.com/spf13/viper v1.7.1
golang.org/x/net v0.0.0-20201110031124-69a78807bb2b
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221
gopkg.in/ini.v1 v1.62.0 // indirect
gopkg.in/yaml.v3 v3.0.0-20200605160147-a5ece683394c // indirect
)
339 changes: 297 additions & 42 deletions go.sum

Large diffs are not rendered by default.

15 changes: 13 additions & 2 deletions keychain/keychain.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ package keychain
import (
"fmt"

"github.com/howeyc/gopass"
"github.com/challarao/keyring"
"golang.org/x/term"
)

const (
Expand Down Expand Up @@ -39,10 +40,20 @@ func (DefaultKeychain) Get(provider string) (pw []byte, err error) {
if err != nil {
// If we ever implement a logfile we might want to log what error occurred.
fmt.Printf("Please enter %s password: ", provider)
pass, err = gopass.GetPasswd()
pass, err = term.ReadPassword(0)
if err != nil {
return nil, fmt.Errorf("couldn't read password from terminal")
}
}
return pass, nil
}

func set(provider string, password []byte) (err error) {
return keyring.Set(KeyChainName, provider, string(password))
}

func get(provider string) (pw []byte, err error) {
pwString, err := keyring.Get(KeyChainName, provider)
pw = []byte(pwString)
return
}
15 changes: 0 additions & 15 deletions keychain/keychain_unix.go

This file was deleted.

19 changes: 0 additions & 19 deletions keychain/keychain_windows.go

This file was deleted.

0 comments on commit bcaab7a

Please sign in to comment.