mirror of
https://github.com/openziti/zrok.git
synced 2025-02-16 18:20:51 +01:00
separate out the OAuth host config from HostMatch (#404)
This commit is contained in:
parent
4c0cfa2815
commit
957e50412e
@ -18,6 +18,7 @@ type Config struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type OauthConfig struct {
|
type OauthConfig struct {
|
||||||
|
Host string
|
||||||
Port int
|
Port int
|
||||||
RedirectUrl string
|
RedirectUrl string
|
||||||
HashKeyRaw string
|
HashKeyRaw string
|
||||||
|
@ -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) {
|
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 {
|
func resolveService(hostMatch string, host string) string {
|
||||||
logrus.Debugf("host = '%v'", host)
|
|
||||||
if hostMatch == "" || strings.Contains(host, hostMatch) {
|
if hostMatch == "" || strings.Contains(host, hostMatch) {
|
||||||
tokens := strings.Split(host, ".")
|
tokens := strings.Split(host, ".")
|
||||||
if len(tokens) > 0 {
|
if len(tokens) > 0 {
|
||||||
|
Loading…
Reference in New Issue
Block a user