diff --git a/main.go b/main.go index be2df0503..f31f66297 100644 --- a/main.go +++ b/main.go @@ -51,6 +51,7 @@ func main() { flagSet.String("htpasswd-file", "", "additionally authenticate against a htpasswd file. Entries must be created with \"htpasswd -s\" for SHA encryption") flagSet.Bool("display-htpasswd-form", true, "display username / password login form if an htpasswd file is provided") flagSet.String("custom-templates-dir", "", "path to custom html templates") + flagSet.String("footer", "", "custom footer string. Use \"-\" to disable default footer.") flagSet.String("proxy-prefix", "/oauth2", "the url root path that this proxy should be nested under (e.g. //sign_in)") flagSet.String("cookie-name", "_oauth2_proxy", "the name of the cookie that the oauth_proxy creates") @@ -98,7 +99,6 @@ func main() { log.Printf("%s", err) os.Exit(1) } - validator := NewValidator(opts.EmailDomains, opts.AuthenticatedEmailsFile) oauthproxy := NewOAuthProxy(opts, validator) diff --git a/oauthproxy.go b/oauthproxy.go index 90cd87e45..1041d7d03 100644 --- a/oauthproxy.go +++ b/oauthproxy.go @@ -66,6 +66,7 @@ type OAuthProxy struct { skipAuthRegex []string compiledRegex []*regexp.Regexp templates *template.Template + Footer string } type UpstreamProxy struct { @@ -199,6 +200,7 @@ func NewOAuthProxy(opts *Options, validator func(string) bool) *OAuthProxy { SkipProviderButton: opts.SkipProviderButton, CookieCipher: cipher, templates: loadTemplates(opts.CustomTemplatesDir), + Footer: opts.Footer, } } @@ -345,6 +347,7 @@ func (p *OAuthProxy) SignInPage(rw http.ResponseWriter, req *http.Request, code Redirect string Version string ProxyPrefix string + Footer template.HTML }{ ProviderName: p.provider.Data().ProviderName, SignInMessage: p.SignInMessage, @@ -352,6 +355,7 @@ func (p *OAuthProxy) SignInPage(rw http.ResponseWriter, req *http.Request, code Redirect: redirect_url, Version: VERSION, ProxyPrefix: p.ProxyPrefix, + Footer: template.HTML(p.Footer), } p.templates.ExecuteTemplate(rw, "sign_in.html", t) } diff --git a/options.go b/options.go index 72c9b5cc6..045e74e35 100644 --- a/options.go +++ b/options.go @@ -35,6 +35,7 @@ type Options struct { HtpasswdFile string `flag:"htpasswd-file" cfg:"htpasswd_file"` DisplayHtpasswdForm bool `flag:"display-htpasswd-form" cfg:"display_htpasswd_form"` CustomTemplatesDir string `flag:"custom-templates-dir" cfg:"custom_templates_dir"` + Footer string `flag:"footer" cfg:"footer"` CookieName string `flag:"cookie-name" cfg:"cookie_name" env:"OAUTH2_PROXY_COOKIE_NAME"` CookieSecret string `flag:"cookie-secret" cfg:"cookie_secret" env:"OAUTH2_PROXY_COOKIE_SECRET"` diff --git a/templates.go b/templates.go index c75227387..836c3efee 100644 --- a/templates.go +++ b/templates.go @@ -130,7 +130,12 @@ func getTemplates() *template.Template { {{ end }}