remove direct mode + add example development compose

This commit is contained in:
Thom Seddon
2018-11-06 14:17:40 +00:00
parent 91775ff0a8
commit dcf4f6574d
4 changed files with 48 additions and 29 deletions

View File

@ -40,8 +40,6 @@ type ForwardAuth struct {
Domain []string
Whitelist []string
Direct bool
Prompt string
}
@ -199,12 +197,6 @@ func (f *ForwardAuth) redirectBase(r *http.Request) string {
proto := r.Header.Get("X-Forwarded-Proto")
host := r.Header.Get("X-Forwarded-Host")
// Direct mode
if f.Direct {
proto = "http"
host = r.Host
}
return fmt.Sprintf("%s://%s", proto, host)
}
@ -212,11 +204,6 @@ func (f *ForwardAuth) redirectBase(r *http.Request) string {
func (f *ForwardAuth) returnUrl(r *http.Request) string {
path := r.Header.Get("X-Forwarded-Uri")
// Testing
if f.Direct {
path = r.URL.String()
}
return fmt.Sprintf("%s%s", f.redirectBase(r), path)
}
@ -325,11 +312,6 @@ func (f *ForwardAuth) Nonce() (error, string) {
func (f *ForwardAuth) cookieDomain(r *http.Request) string {
host := r.Header.Get("X-Forwarded-Host")
// Direct mode
if f.Direct {
host = r.Host
}
// Check if any of the given cookie domains matches
_, domain := f.matchCookieDomains(host)
return domain
@ -340,8 +322,6 @@ func (f *ForwardAuth) csrfCookieDomain(r *http.Request) string {
var host string
if use, domain := f.useAuthDomain(r); use {
host = domain
} else if f.Direct {
host = r.Host
} else {
host = r.Header.Get("X-Forwarded-Host")
}