Documentation ¶
Index ¶
- Constants
- func Exhaust(r *http.Request)
- func Middleware(handlerFunc func(w http.ResponseWriter, r *http.Request)) *middleware
- type AuthManager
- type AuthSession
- type ErrorBufferTooSmall
- type KubeFactory
- type KubeManager
- type LoginParams
- type ProxyHandler
- type ReplaceReader
- type Session
- type SessionKeyType
- type TemplateParams
Constants ¶
const ( STATICPATH = "/podstatic/" LOGINPATH = "/podapi/login" LOGOUTPATH = "/podapi/logout" HEALTHZPATH = "/healthz" KILLPATH = "/podapi/kill" SPAWNPATH = "/podapi/spawn" INFOPATH = "/podapi/info" )
Paths that trigger server routines
const ( ErrorTemplate = "errorPage.html" KillTemplate = "killPage.html" SpawnTemplate = "spawnPage.html" WaitTemplate = "waitPage.html" LoginTemplate = "loginPage.html" )
Templates for each feedback page
const CSRFCOOKIE = "KEYPROXY_CSRF"
CSRF Cookie name
const CSRFHEADER = "X-Csrf-Token"
CSRF Header Name
const MEMORY_BUFFER_SIZE = 16
MEMORY_BUFFER_SIZE is the amount of bytes to carry in the memory buffer
const SESSIONCOOKIE = "KEYPROXY_SESSION"
Session Cookie name
Variables ¶
This section is empty.
Functions ¶
func Middleware ¶
func Middleware(handlerFunc func(w http.ResponseWriter, r *http.Request)) *middleware
Middleware constructor facilitates chaining middlewares
Types ¶
type AuthManager ¶
type AuthManager interface { Check(token string) (auth.Credentials, AuthSession, error) Login(creds auth.Credentials, password string) (AuthSession, error) }
AuthManager encapsulates the methods expected from auth manager
type AuthSession ¶
type AuthSession interface { kube.JWTSession Logout() }
AuthSession encapsulates the methods expected from auth session
type ErrorBufferTooSmall ¶
type ErrorBufferTooSmall string
ErrorBufferTooSmall raised when reader has no room
func (ErrorBufferTooSmall) Error ¶
func (err ErrorBufferTooSmall) Error() string
type KubeFactory ¶
type KubeFactory interface { Find(auth.Credentials) (KubeManager, error) ServerVersion() (version fmt.Stringer, err error) }
KubeFactory encapsulates method sexpected from a pod factory
type KubeManager ¶
type KubeManager interface { Delete(context.Context) error Proxy(ctx context.Context, create bool) (*kube.PodProxy, kube.PodInfo, error) }
KubeManager encapsulates the methods expected from a pod manager
type LoginParams ¶
type LoginParams struct { ProxyScheme string `json:"proxyScheme"` Host string `json:"host"` Service string `json:"service"` Username string `json:"username"` ErrMessage string `json:"errMessage"` CSRFTag htmlTemplate.HTML `json:"-"` }
LoginParams passed to login page template
type ProxyHandler ¶
type ProxyHandler struct { clock.Keeper Logger *log.Logger Redirect string // Where to redirect requests for "/" ProxyScheme string // scheme for the login page, "http" or "https" Static fs.FS StaticLogin bool // true if there is an 'index.html' in podstatic Auth AuthManager Factory KubeFactory Paths []string // Paths supported by pod *http.ServeMux // contains filtered or unexported fields }
ProxyHandler manages the pod lifecycle requests and proxies other requests.
func New ¶
func New(logger *log.Logger, redirect, proxyScheme string, corsOrigins []string, templates, static fs.FS, authManager AuthManager, factory KubeFactory, paths []string) (*ProxyHandler, error)
New creates new proxy handler
func (*ProxyHandler) LoginForm ¶
func (h *ProxyHandler) LoginForm(w http.ResponseWriter, r *http.Request)
LoginForm processes the login form and sets a cookie
func (*ProxyHandler) NewParams ¶
func (h *ProxyHandler) NewParams(r *http.Request, session Session, create bool) (TemplateParams, error)
type ReplaceReader ¶
ReplaceReader is a hack to make wso2 js work.
func (*ReplaceReader) Close ¶
func (rb *ReplaceReader) Close() error
Close implementents io.ReadCloser
type Session ¶
type Session struct { Credentials auth.Credentials AuthSession AuthSession Manager KubeManager Logger *log.Entry }
type SessionKeyType ¶
type SessionKeyType int
AuthSessionKeyType used for storing session in request context.
type TemplateParams ¶
type TemplateParams struct { ProxyScheme string `json:"proxyScheme"` Host string `json:"host"` Service string `json:"service"` Username string `json:"username"` EventType kube.EventType `json:"eventType"` PodPhase kube.PodPhase `json:"podPhase"` Ready bool `json:"ready"` Address string `json:"address"` Paths []string `json:"paths"` // Additional paths supported by pod }
TemplateParams passed to all other template pages