ErrorPage writes an error response
(rw http.ResponseWriter, req *http.Request, code int, appError string, messages ...interface{})
| 567 | |
| 568 | // ErrorPage writes an error response |
| 569 | func (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 |
| 589 | func (p *OAuthProxy) IsAllowedRequest(req *http.Request) bool { |
no test coverage detected