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) {
|
||||
name := "generic"
|
||||
if s.GenericName != "" {
|
||||
name = s.GenericName
|
||||
}
|
||||
|
||||
redirectURL := s.PublicURL + s.Basepath + "/oauth/" + name + "/callback"
|
||||
gen := oauth2.Generic{
|
||||
PageName: s.GenericName,
|
||||
ClientID: s.GenericClientID,
|
||||
ClientSecret: s.GenericClientSecret,
|
||||
RequiredScopes: s.GenericScopes,
|
||||
Domains: s.GenericDomains,
|
||||
RedirectURL: redirectURL,
|
||||
RedirectURL: s.genericRedirectURL(),
|
||||
AuthURL: s.GenericAuthURL,
|
||||
TokenURL: s.GenericTokenURL,
|
||||
APIURL: s.GenericAPIURL,
|
||||
|
@ -178,6 +172,19 @@ func (s *Server) genericOAuth(logger chronograf.Logger, auth oauth2.Authenticato
|
|||
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
|
||||
type BuildInfo struct {
|
||||
Version string
|
||||
|
|
Loading…
Reference in New Issue