1
0
mirror of https://github.com/oauth2-proxy/oauth2-proxy.git synced 2025-08-08 22:46:33 +02:00

Add static pages to PageWriter interface

This commit is contained in:
Joel Speed
2021-03-13 09:52:07 +00:00
parent c1267bb92d
commit 9782fc7fa4
4 changed files with 261 additions and 0 deletions

View File

@@ -13,12 +13,14 @@ type Writer interface {
WriteSignInPage(rw http.ResponseWriter, req *http.Request, redirectURL string)
WriteErrorPage(rw http.ResponseWriter, opts ErrorPageOpts)
ProxyErrorHandler(rw http.ResponseWriter, req *http.Request, proxyErr error)
WriteRobotsTxt(rw http.ResponseWriter, req *http.Request)
}
// pageWriter implements the Writer interface
type pageWriter struct {
*errorPageWriter
*signInPageWriter
*staticPageWriter
}
// Opts contains all options required to configure the template
@@ -88,8 +90,14 @@ func NewWriter(opts Opts) (Writer, error) {
logoData: logoData,
}
staticPages, err := newStaticPageWriter(opts.TemplatesPath, errorPage)
if err != nil {
return nil, fmt.Errorf("error loading static page writer: %v", err)
}
return &pageWriter{
errorPageWriter: errorPage,
signInPageWriter: signInPage,
staticPageWriter: staticPages,
}, nil
}