Skip to content
This repository has been archived by the owner on Apr 7, 2022. It is now read-only.

Commit

Permalink
log more info about what we did with stored credentials
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomas Hopkins committed Jun 6, 2017
1 parent ec80dcf commit 3a6e8bf
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,6 @@ func getSessionFromLogin(oktaCfg *OktaConfig) (string, error) {

keystore, err := keytar.GetKeychain()
if err != nil {
fmt.Println("Failed to get keychain access")
debug("error was %s", err)
return "", errors.New("failed to get keychain access")
}
Expand All @@ -202,6 +201,7 @@ func getSessionFromLogin(oktaCfg *OktaConfig) (string, error) {
}

if user != "" && pass != "" {
debug("stored okta credentials found, attempting to use them")
sessionToken, err := tryLogin(oktaCfg, user, pass)
if err == nil {
return sessionToken, err
Expand All @@ -210,6 +210,8 @@ func getSessionFromLogin(oktaCfg *OktaConfig) (string, error) {
user = ""
pass = ""
// give the user the chance to log in by typing in username/password
} else {
debug("stored okta credentials not found; will prompt for them")
}

err = keystore.DeletePassword(APPNAME, CREDENTIALS_USERNAME)
Expand Down Expand Up @@ -237,11 +239,11 @@ func getSessionFromLogin(oktaCfg *OktaConfig) (string, error) {
if err == nil && sessionToken != "" {
keystore.AddPassword(APPNAME, CREDENTIALS_USERNAME, user)
if err != nil {
debug("err storing username", err)
debug("err storing username: %s", err)
}
keystore.AddPassword(APPNAME, CREDENTIALS_PASSWORD, pass)
if err != nil {
debug("err storing password", err)
debug("err storing password: %s", err)
}
}
return sessionToken, err
Expand Down

0 comments on commit 3a6e8bf

Please sign in to comment.