MCPcopy
hub / github.com/oauth2-proxy/oauth2-proxy / ErrorPage

Method ErrorPage

oauthproxy.go:569–586  ·  view source on GitHub ↗

ErrorPage writes an error response

(rw http.ResponseWriter, req *http.Request, code int, appError string, messages ...interface{})

Source from the content-addressed store, hash-verified

567
568// ErrorPage writes an error response
569func (p *OAuthProxy) ErrorPage(rw http.ResponseWriter, req *http.Request, code int, appError string, messages ...interface{}) {
570 redirectURL, err := p.appDirector.GetRedirect(req)
571 if err != nil {
572 logger.Errorf("Error obtaining redirect: %v", err)
573 }
574 if redirectURL == p.SignInPath || redirectURL == "" {
575 redirectURL = "/"
576 }
577
578 scope := middlewareapi.GetRequestScope(req)
579 p.pageWriter.WriteErrorPage(rw, pagewriter.ErrorPageOpts{
580 Status: code,
581 RedirectURL: redirectURL,
582 RequestID: scope.RequestID,
583 AppError: appError,
584 Messages: messages,
585 })
586}
587
588// IsAllowedRequest is used to check if auth should be skipped for this request
589func (p *OAuthProxy) IsAllowedRequest(req *http.Request) bool {

Callers 7

SignInPageMethod · 0.95
SignInMethod · 0.95
UserInfoMethod · 0.95
SignOutMethod · 0.95
doOAuthStartMethod · 0.95
OAuthCallbackMethod · 0.95
ProxyMethod · 0.95

Calls 3

ErrorfFunction · 0.92
GetRedirectMethod · 0.65
WriteErrorPageMethod · 0.65

Tested by

no test coverage detected