Don't pass RedirectURL if PublicURL not set
parent
a231e9f942
commit
0bb20c8a0f
|
@ -155,19 +155,13 @@ func (s *Server) herokuOAuth(logger chronograf.Logger, auth oauth2.Authenticator
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Server) genericOAuth(logger chronograf.Logger, auth oauth2.Authenticator) (oauth2.Provider, oauth2.Mux, func() bool) {
|
func (s *Server) genericOAuth(logger chronograf.Logger, auth oauth2.Authenticator) (oauth2.Provider, oauth2.Mux, func() bool) {
|
||||||
name := "generic"
|
|
||||||
if s.GenericName != "" {
|
|
||||||
name = s.GenericName
|
|
||||||
}
|
|
||||||
|
|
||||||
redirectURL := s.PublicURL + s.Basepath + "/oauth/" + name + "/callback"
|
|
||||||
gen := oauth2.Generic{
|
gen := oauth2.Generic{
|
||||||
PageName: s.GenericName,
|
PageName: s.GenericName,
|
||||||
ClientID: s.GenericClientID,
|
ClientID: s.GenericClientID,
|
||||||
ClientSecret: s.GenericClientSecret,
|
ClientSecret: s.GenericClientSecret,
|
||||||
RequiredScopes: s.GenericScopes,
|
RequiredScopes: s.GenericScopes,
|
||||||
Domains: s.GenericDomains,
|
Domains: s.GenericDomains,
|
||||||
RedirectURL: redirectURL,
|
RedirectURL: s.genericRedirectURL(),
|
||||||
AuthURL: s.GenericAuthURL,
|
AuthURL: s.GenericAuthURL,
|
||||||
TokenURL: s.GenericTokenURL,
|
TokenURL: s.GenericTokenURL,
|
||||||
APIURL: s.GenericAPIURL,
|
APIURL: s.GenericAPIURL,
|
||||||
|
@ -178,6 +172,19 @@ func (s *Server) genericOAuth(logger chronograf.Logger, auth oauth2.Authenticato
|
||||||
return &gen, genMux, s.UseGenericOAuth2
|
return &gen, genMux, s.UseGenericOAuth2
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s *Server) genericRedirectURL() string {
|
||||||
|
if s.PublicURL == "" {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
genericName := "generic"
|
||||||
|
if s.GenericName != "" {
|
||||||
|
genericName = s.GenericName
|
||||||
|
}
|
||||||
|
|
||||||
|
return s.PublicURL + s.Basepath + "/oauth/" + genericName + "/callback"
|
||||||
|
}
|
||||||
|
|
||||||
// BuildInfo is sent to the usage client to track versions and commits
|
// BuildInfo is sent to the usage client to track versions and commits
|
||||||
type BuildInfo struct {
|
type BuildInfo struct {
|
||||||
Version string
|
Version string
|
||||||
|
|
Loading…
Reference in New Issue