Documentation ¶
Index ¶
- Constants
- func AuthenticationErrorCode(err error) string
- func AuthenticationErrorMessage(code string) string
- func GrantErrorCode(err error) string
- func GrantErrorMessage(code string) string
- func ValidateErrorPageTemplate(templateContent []byte) []error
- type ErrorData
- type ErrorPage
- type ErrorPageRenderer
Constants ¶
const ErrorPageTemplateExample = `` /* 1172-byte string literal not displayed */
ErrorPageTemplateExample is a basic template for customizing the error page.
Variables ¶
This section is empty.
Functions ¶
func AuthenticationErrorCode ¶
AuthenticationErrorCode returns an error code for the given authentication error. If the error is not recognized, a generic error code is returned.
func AuthenticationErrorMessage ¶
AuthenticationErrorMessage returns an error message for the given authentication error code. If the error code is not recognized, a generic error message is returned.
func GrantErrorCode ¶
GrantErrorCode returns an error code for the given grant error. If the error is not recognized, a generic error code is returned.
func GrantErrorMessage ¶
GrantErrorMessage returns an error message for the given grant error code. If the error is not recognized, a generic error message is returned.
func ValidateErrorPageTemplate ¶
ValidateErrorPageTemplate ensures the given template does not error when rendered with an ErrorData object as input
Types ¶
type ErrorPage ¶
type ErrorPage struct {
// contains filtered or unexported fields
}
ErrorPage implements auth and grant error handling by rendering an error page for browser-like clients
func NewErrorPageHandler ¶
func NewErrorPageHandler(renderer ErrorPageRenderer) *ErrorPage
NewErrorPageHandler returns an auth and grant error handler using the given renderer
func (*ErrorPage) AuthenticationError ¶
func (*ErrorPage) GrantError ¶
type ErrorPageRenderer ¶
type ErrorPageRenderer interface {
Render(data ErrorData, w http.ResponseWriter, req *http.Request)
}
ErrorPageRenderer handles rendering a given error code/message
func NewErrorPageTemplateRenderer ¶
func NewErrorPageTemplateRenderer(templateFile string) (ErrorPageRenderer, error)
NewErrorPageRenderer creates an error page renderer that takes in an optional custom template to allow branding of the page. Uses the default if templateFile is not set.