Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIX - When the password contains "$" character the login not working well. #351

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions cmd/gateclient/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,17 @@ func userConfig(gateClient *GatewayClient, configLocation string) error {
// but unmarshal to an upstream oauth package, so the cached token needs to match
// https://godoc.org/golang.org/x/oauth2#Token
if yamlFile != nil {

err = yaml.UnmarshalStrict([]byte(string(yamlFile)), &gateClient.Config)
if err != nil {
gateClient.ui.Error(fmt.Sprintf("Could not deserialize config file with contents: %s, failing.", yamlFile))
return err
}

if gateClient.Config.Auth.DisabeSystemEnvironment {
return nil
}

err = yaml.UnmarshalStrict([]byte(os.ExpandEnv(string(yamlFile))), &gateClient.Config)
vitorjordao marked this conversation as resolved.
Show resolved Hide resolved
if err != nil {
gateClient.ui.Error(fmt.Sprintf("Could not deserialize config file with contents: %s, failing.", yamlFile))
Expand Down
17 changes: 9 additions & 8 deletions config/auth/authconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,15 @@ import (

// Config is the CLI's authentication configuration.
type Config struct {
Enabled bool `json:"enabled" yaml:"enabled"`
IgnoreRedirects bool `json:"ignoreRedirects" yaml:"ignoreRedirects"`
IgnoreCertErrors bool `json:"ignoreCertErrors" yaml:"ignoreCertErrors"`
X509 *x509.Config `json:"x509,omitempty" yaml:"x509,omitempty"`
OAuth2 *oauth2.Config `json:"oauth2,omitempty" yaml:"oauth2,omitempty"`
Basic *basic.Config `json:"basic,omitempty" yaml:"basic,omitempty"`
Iap *config.Config `json:"iap,omitempty" yaml:"iap,omitempty"`
Ldap *ldap.Config `json:"ldap,omitempty" yaml:"ldap,omitempty"`
Enabled bool `json:"enabled" yaml:"enabled"`
DisabeSystemEnvironment bool `json:"disabeSystemEnvironment" yaml:"DisabeSystemEnvironment"`
IgnoreRedirects bool `json:"ignoreRedirects" yaml:"ignoreRedirects"`
IgnoreCertErrors bool `json:"ignoreCertErrors" yaml:"ignoreCertErrors"`
X509 *x509.Config `json:"x509,omitempty" yaml:"x509,omitempty"`
OAuth2 *oauth2.Config `json:"oauth2,omitempty" yaml:"oauth2,omitempty"`
Basic *basic.Config `json:"basic,omitempty" yaml:"basic,omitempty"`
Iap *config.Config `json:"iap,omitempty" yaml:"iap,omitempty"`
Ldap *ldap.Config `json:"ldap,omitempty" yaml:"ldap,omitempty"`

GoogleServiceAccount *gsa.Config `json:"google_service_account,omitempty" yaml:"google_service_account,omitempty"`
}
2 changes: 2 additions & 0 deletions config/example.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ gate:
endpoint: https://my-spinnaker-gate:8084
retryTimeout: 300
auth:
# If your user or password contains "$" character, you need to escape it with this flag:
disabeSystemEnvironment: true
enabled: true
x509:
# See https://www.spinnaker.io/setup/security/ssl/ and
Expand Down