@@ -59,6 +59,7 @@ type OAuthProxy struct {
5959 DisplayHtpasswdForm bool
6060 serveMux http.Handler
6161 PassBasicAuth bool
62+ SkipProviderButton bool
6263 BasicAuthPassword string
6364 PassAccessToken bool
6465 CookieCipher *cookie.Cipher
@@ -186,17 +187,18 @@ func NewOAuthProxy(opts *Options, validator func(string) bool) *OAuthProxy {
186187 OAuthCallbackPath: fmt.Sprintf("%s/callback", opts.ProxyPrefix),
187188 AuthOnlyPath: fmt.Sprintf("%s/auth", opts.ProxyPrefix),
188189
189− ProxyPrefix: opts.ProxyPrefix,
190− provider: opts.provider,
191− serveMux: serveMux,
192− redirectURL: redirectURL,
193− skipAuthRegex: opts.SkipAuthRegex,
194− compiledRegex: opts.CompiledRegex,
195− PassBasicAuth: opts.PassBasicAuth,
196− BasicAuthPassword: opts.BasicAuthPassword,
197− PassAccessToken: opts.PassAccessToken,
198− CookieCipher: cipher,
199− templates: loadTemplates(opts.CustomTemplatesDir),
190+ ProxyPrefix: opts.ProxyPrefix,
191+ provider: opts.provider,
192+ serveMux: serveMux,
193+ redirectURL: redirectURL,
194+ skipAuthRegex: opts.SkipAuthRegex,
195+ compiledRegex: opts.CompiledRegex,
196+ PassBasicAuth: opts.PassBasicAuth,
197+ BasicAuthPassword: opts.BasicAuthPassword,
198+ PassAccessToken: opts.PassAccessToken,
199+ SkipProviderButton: opts.SkipProviderButton,
200+ CookieCipher: cipher,
201+ templates: loadTemplates(opts.CustomTemplatesDir),
200202 }
201203}
202204
@@ -511,7 +513,11 @@ func (p *OAuthProxy) Proxy(rw http.ResponseWriter, req *http.Request) {
511513 p.ErrorPage(rw, http.StatusInternalServerError,
512514 "Internal Error", "Internal Error")
513515 } else if status == http.StatusForbidden {
514− p.SignInPage(rw, req, http.StatusForbidden)
516+ if p.SkipProviderButton {
517+ p.OAuthStart(rw, req)
518+ } else {
519+ p.SignInPage(rw, req, http.StatusForbidden)
520+ }
515521 } else {
516522 p.serveMux.ServeHTTP(rw, req)
517523 }