separate out the OAuth host config from HostMatch (#404)

This commit is contained in:
Michael Quigley 2023-09-28 13:01:36 -04:00
parent 4c0cfa2815
commit 957e50412e
No known key found for this signature in database
GPG Key ID: 9B60314A9DD20A62
2 changed files with 2 additions and 2 deletions

View File

@ -18,6 +18,7 @@ type Config struct {
}
type OauthConfig struct {
Host string
Port int
RedirectUrl string
HashKeyRaw string

View File

@ -334,11 +334,10 @@ func basicAuthRequired(w http.ResponseWriter, realm string) {
}
func oauthLoginRequired(w http.ResponseWriter, r *http.Request, shrToken string, pcfg *Config, provider, target string, authCheckInterval time.Duration) {
http.Redirect(w, r, fmt.Sprintf("http://%s.%s:%d/%s/login?targethost=%s&checkInterval=%s", shrToken, pcfg.HostMatch, pcfg.Oauth.Port, provider, url.QueryEscape(target), authCheckInterval.String()), http.StatusFound)
http.Redirect(w, r, fmt.Sprintf("http://%s.%s:%d/%s/login?targethost=%s&checkInterval=%s", shrToken, pcfg.Oauth.Host, pcfg.Oauth.Port, provider, url.QueryEscape(target), authCheckInterval.String()), http.StatusFound)
}
func resolveService(hostMatch string, host string) string {
logrus.Debugf("host = '%v'", host)
if hostMatch == "" || strings.Contains(host, hostMatch) {
tokens := strings.Split(host, ".")
if len(tokens) > 0 {