{"modulePath":"github.com/2lambda123/openshift-origin","version":"v4.1.0+incompatible","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package errorpage\n\n## Constants\n\n```go\nconst ErrorPageTemplateExample = `\u003c!DOCTYPE html\u003e\n\u003c!--\n\nThis template can be modified and used to customize the error page. To replace\nthe error page, set master configuration option oauthConfig.templates.error to\nthe path of the template file.\n\noauthConfig:\n  templates:\n    error: templates/error-template.html\n\nThe Error field contains an error message, which is human readable, and subject to change.\nDefault error messages are intentionally generic to avoid leaking information about authentication errors.\n\nThe ErrorCode field contains a programmatic error code, which may be (but is not limited to):\n- mapping_claim_error\n- mapping_lookup_error\n- authentication_error\n- grant_error\n--\u003e\n\u003chtml\u003e\n  \u003chead\u003e\n    \u003ctitle\u003eError\u003c/title\u003e\n    \u003cstyle type=\"text/css\"\u003e\n      body {\n        font-family: \"Open Sans\", Helvetica, Arial, sans-serif;\n        font-size: 14px;\n        margin: 15px;\n      }\n    \u003c/style\u003e\n  \u003c/head\u003e\n  \u003cbody\u003e\n\n    \u003cdiv\u003e\n\t\t\u003c!-- example of handling a particular error code in a special way --\u003e\n\t\t{{ if eq .ErrorCode \"mapping_claim_error\" }}\n\t\t\tCould not create your user. Contact your administrator to resolve this issue.\n\t\t{{ else }}\n\t\t\t{{ .Error }}\n\t\t{{ end }}\n\t\t\u003c/div\u003e\n\n  \u003c/body\u003e\n\u003c/html\u003e\n`\n```\nErrorPageTemplateExample is a basic template for customizing the error page.\n\n## Functions\n\n```go\nfunc AuthenticationErrorCode(err error) string\n```\nAuthenticationErrorCode returns an error code for the given authentication error. If the error is not recognized, a generic error code is returned.\n\n```go\nfunc AuthenticationErrorMessage(code string) string\n```\nAuthenticationErrorMessage returns an error message for the given authentication error code. If the error code is not recognized, a generic error message is returned.\n\n```go\nfunc GrantErrorCode(err error) string\n```\nGrantErrorCode returns an error code for the given grant error. If the error is not recognized, a generic error code is returned.\n\n```go\nfunc GrantErrorMessage(code string) string\n```\nGrantErrorMessage returns an error message for the given grant error code. If the error is not recognized, a generic error message is returned.\n\n```go\nfunc ValidateErrorPageTemplate(templateContent []byte) []error\n```\nValidateErrorPageTemplate ensures the given template does not error when rendered with an ErrorData object as input\n\n## Types\n\n```go\ntype ErrorData struct {\n\tError     string\n\tErrorCode string\n}\n```\nErrorData holds fields for the error page renderer\n\n```go\ntype ErrorPage struct {\n\t// contains filtered or unexported fields\n}\n```\nErrorPage implements auth and grant error handling by rendering an error page for browser-like clients\n\n```go\nfunc NewErrorPageHandler(renderer ErrorPageRenderer) *ErrorPage\n```\nNewErrorPageHandler returns an auth and grant error handler using the given renderer\n\n```go\nfunc (p *ErrorPage) AuthenticationError(err error, w http.ResponseWriter, req *http.Request) (bool, error)\n```\n\n```go\nfunc (p *ErrorPage) GrantError(err error, w http.ResponseWriter, req *http.Request) (bool, error)\n```\n\n```go\ntype ErrorPageRenderer interface {\n\tRender(data ErrorData, w http.ResponseWriter, req *http.Request)\n}\n```\nErrorPageRenderer handles rendering a given error code/message\n\n```go\nfunc NewErrorPageTemplateRenderer(templateFile string) (ErrorPageRenderer, error)\n```\nNewErrorPageRenderer 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.\n\n","path":"github.com/2lambda123/openshift-origin/pkg/oauthserver/server/errorpage","name":"errorpage","synopsis":"","isRedistributable":true}
