Skip to content

Commit

Permalink
modified securePassword name to authSP to avoid linter/snyk issues
Browse files Browse the repository at this point in the history
  • Loading branch information
pacificcode committed Aug 12, 2024
1 parent 0632390 commit 9743a3f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions auth/method_password.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import (
"github.com/spf13/viper"
)

const authSP = "auth.securePassword"

func buildPasswordParams() (*requestBody, error) {
data := &requestBody{
GrantType: authTypeToGrantType[Password],
Expand All @@ -20,13 +22,13 @@ func buildPasswordParams() (*requestBody, error) {
// If it is an empty string, look for SecurePassword, which Viper gets only from config. Get the corresponding
// key file and use it to decrypt SecurePassword.
if data.Password == "" {
passSetting := "auth.securePassword"
passSetting := authSP

Check warning on line 25 in auth/method_password.go

View check run for this annotation

Codecov / codecov/patch

auth/method_password.go#L25

Added line #L25 was not covered by tests
storeType := viper.GetString(cst.StoreType)
if storeType == store.WinCred || storeType == store.PassLinux {
passSetting = cst.Password
}
if pass, err := store.GetSecureSetting(passSetting); err == nil && pass != "" {
if passSetting == "auth.securePassword" {
if passSetting == authSP {

Check warning on line 31 in auth/method_password.go

View check run for this annotation

Codecov / codecov/patch

auth/method_password.go#L31

Added line #L31 was not covered by tests
keyPath := GetEncryptionKeyFilename(viper.GetString(cst.Tenant), data.Username)
key, err := store.ReadFileInDefaultPath(keyPath)
if err != nil || key == "" {
Expand Down

0 comments on commit 9743a3f

Please sign in to comment.