Documentation ¶
Index ¶
- type ErrorPageOpts
- type Opts
- type Writer
- type WriterFuncs
- func (w *WriterFuncs) ProxyErrorHandler(rw http.ResponseWriter, req *http.Request, proxyErr error)
- func (w *WriterFuncs) WriteErrorPage(rw http.ResponseWriter, opts ErrorPageOpts)
- func (w *WriterFuncs) WriteRobotsTxt(rw http.ResponseWriter, req *http.Request)
- func (w *WriterFuncs) WriteSignInPage(rw http.ResponseWriter, req *http.Request, redirectURL string, statusCode int)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ErrorPageOpts ¶
type ErrorPageOpts struct { // HTTP status code Status int // Redirect URL for "Go back" and "Sign in" buttons RedirectURL string // The UUID of the request RequestID string // App Error shown in debug mode AppError string // Generic error messages shown in non-debug mode Messages []interface{} }
ErrorPageOpts bundles up all the content needed to write the Error Page
type Opts ¶
type Opts struct { // TemplatesPath is the path from which to load custom templates for the sign-in and error pages. TemplatesPath string // ProxyPrefix is the prefix under which OAuth2 Proxy pages are served. ProxyPrefix string // If not set, a default footer will be used. Footer string // Version is the OAuth2 Proxy version to be used in the default footer. Version string // Debug determines whether errors pages should be rendered with detailed // errors. Debug bool // DisplayLoginForm determines whether or not the basic auth password form is displayed on the sign-in page. DisplayLoginForm bool // ProviderName is the name of the provider that should be displayed on the login button. ProviderName string // SignInMessage is the messge displayed above the login button. SignInMessage string // CustomLogo is the path or URL to a logo to be displayed on the sign in page. // The logo can be either PNG, JPG/JPEG or SVG. // If a URL is used, image support depends on the browser. CustomLogo string }
Opts contains all options required to configure the template rendering within OAuth2 Proxy.
type Writer ¶
type Writer interface { WriteSignInPage(rw http.ResponseWriter, req *http.Request, redirectURL string, statusCode int) WriteErrorPage(rw http.ResponseWriter, opts ErrorPageOpts) ProxyErrorHandler(rw http.ResponseWriter, req *http.Request, proxyErr error) WriteRobotsTxt(rw http.ResponseWriter, req *http.Request) }
Writer is an interface for rendering html templates for both sign-in and error pages. It can also be used to write errors for the http.ReverseProxy used in the upstream package.
type WriterFuncs ¶
type WriterFuncs struct { SignInPageFunc func(rw http.ResponseWriter, req *http.Request, redirectURL string, statusCode int) ErrorPageFunc func(rw http.ResponseWriter, opts ErrorPageOpts) ProxyErrorFunc func(rw http.ResponseWriter, req *http.Request, proxyErr error) RobotsTxtfunc func(rw http.ResponseWriter, req *http.Request) }
WriterFuncs is an implementation of the PageWriter interface based on override functions. If any of the funcs are not provided, a default implementation will be used. This is primarily for us in testing.
func (*WriterFuncs) ProxyErrorHandler ¶
func (w *WriterFuncs) ProxyErrorHandler(rw http.ResponseWriter, req *http.Request, proxyErr error)
ProxyErrorHandler implements the Writer interface. If the ProxyErrorFunc is provided, this will be used, else a default implementation will be used.
func (*WriterFuncs) WriteErrorPage ¶
func (w *WriterFuncs) WriteErrorPage(rw http.ResponseWriter, opts ErrorPageOpts)
WriteErrorPage implements the Writer interface. If the ErrorPageFunc is provided, this will be used, else a default implementation will be used.
func (*WriterFuncs) WriteRobotsTxt ¶
func (w *WriterFuncs) WriteRobotsTxt(rw http.ResponseWriter, req *http.Request)
WriteRobotsTxt implements the Writer interface. If the RobotsTxtfunc is provided, this will be used, else a default implementation will be used.
func (*WriterFuncs) WriteSignInPage ¶
func (w *WriterFuncs) WriteSignInPage(rw http.ResponseWriter, req *http.Request, redirectURL string, statusCode int)
WriteSignInPage implements the Writer interface. If the SignInPageFunc is provided, this will be used, else a default implementation will be used.