* initial implementation Signed-off-by: Jens Langhammer <jens@goauthentik.io> * check for openid/profile claims Signed-off-by: Jens Langhammer <jens@goauthentik.io> * include jwks sources in proxy provider Signed-off-by: Jens Langhammer <jens@goauthentik.io> * add web ui for jwks Signed-off-by: Jens Langhammer <jens@goauthentik.io> * only show sources with JWKS data configured Signed-off-by: Jens Langhammer <jens@goauthentik.io> * fix introspection tests Signed-off-by: Jens Langhammer <jens@goauthentik.io> * start basic Signed-off-by: Jens Langhammer <jens@goauthentik.io> * add basic auth Signed-off-by: Jens Langhammer <jens@goauthentik.io> * add docs, update admonitions Signed-off-by: Jens Langhammer <jens@goauthentik.io> * add client_id to api, add tab for auth Signed-off-by: Jens Langhammer <jens@goauthentik.io> * update locale Signed-off-by: Jens Langhammer <jens@goauthentik.io> Signed-off-by: Jens Langhammer <jens@goauthentik.io>
		
			
				
	
	
		
			42 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			42 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			Go
		
	
	
	
	
	
package application
 | 
						|
 | 
						|
import (
 | 
						|
	"fmt"
 | 
						|
	"net/http"
 | 
						|
 | 
						|
	log "github.com/sirupsen/logrus"
 | 
						|
)
 | 
						|
 | 
						|
type ErrorPageData struct {
 | 
						|
	Title       string
 | 
						|
	Message     string
 | 
						|
	ProxyPrefix string
 | 
						|
}
 | 
						|
 | 
						|
func (a *Application) ErrorPage(rw http.ResponseWriter, r *http.Request, err string) {
 | 
						|
	claims, _ := a.checkAuth(rw, r)
 | 
						|
	data := ErrorPageData{
 | 
						|
		Title:       "Bad Gateway",
 | 
						|
		Message:     "Error proxying to upstream server",
 | 
						|
		ProxyPrefix: "/outpost.goauthentik.io",
 | 
						|
	}
 | 
						|
	if claims != nil && claims.Proxy.IsSuperuser {
 | 
						|
		data.Message = err
 | 
						|
	} else {
 | 
						|
		data.Message = "Failed to connect to backend."
 | 
						|
	}
 | 
						|
	er := a.errorTemplates.Execute(rw, data)
 | 
						|
	if er != nil {
 | 
						|
		http.Error(rw, "Internal Server Error", http.StatusInternalServerError)
 | 
						|
	}
 | 
						|
}
 | 
						|
 | 
						|
// NewProxyErrorHandler creates a ProxyErrorHandler using the template given.
 | 
						|
func (a *Application) newProxyErrorHandler() func(http.ResponseWriter, *http.Request, error) {
 | 
						|
	return func(rw http.ResponseWriter, req *http.Request, proxyErr error) {
 | 
						|
		log.WithError(proxyErr).Warning("Error proxying to upstream server")
 | 
						|
		rw.WriteHeader(http.StatusBadGateway)
 | 
						|
		a.ErrorPage(rw, req, fmt.Sprintf("Error proxying to upstream server: %v", proxyErr))
 | 
						|
	}
 | 
						|
}
 |