fix: remove common public-url config from oauth validation check (#5475)

pull/5487/head
Greg 2020-05-05 15:42:41 -06:00 committed by GitHub
parent 86f6051776
commit 00cce510f2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 30 additions and 3 deletions

View File

@ -2,6 +2,8 @@
### Bug Fixes
1. [#5475](https://github.com/influxdata/chronograf/pull/5475): Fix public-url generic oauth configuration issue
### Features
### Other

View File

@ -171,7 +171,7 @@ func (s *Server) UseGoogle() error {
if s.TokenSecret != "" && s.GoogleClientID != "" && s.GoogleClientSecret != "" && s.PublicURL != "" {
return nil
} else if s.GoogleClientID == "" && s.GoogleClientSecret == "" && s.PublicURL == "" {
} else if s.GoogleClientID == "" && s.GoogleClientSecret == "" {
return errNoAuth
}

View File

@ -150,11 +150,36 @@ func TestValidAuth(t *testing.T) {
},
err: "token secret without oauth config is invalid",
},
{
desc: "test valid generic config",
s: &Server{
TokenSecret: "abc123",
GenericClientID: "abc123",
GenericClientSecret: "abc123",
GenericAuthURL: "abc123",
GenericTokenURL: "abc123",
},
err: "<nil>",
},
{
desc: "test valid generic config with public url",
s: &Server{
TokenSecret: "abc123",
GenericClientID: "abc123",
GenericClientSecret: "abc123",
GenericAuthURL: "abc123",
GenericTokenURL: "abc123",
PublicURL: "abc123",
},
err: "<nil>",
},
}
for _, test := range tests {
err := test.s.validateAuth()
assert.Equal(t, test.err, fmt.Sprintf("%v", err), test.desc)
t.Run(test.desc, func(t *testing.T) {
err := test.s.validateAuth()
assert.Equal(t, test.err, fmt.Sprintf("%v", err), test.desc)
})
}
}