proxy

package
v0.2.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 31, 2021 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Server

type Server struct {
	APIPath     string
	BaseAddress string

	APIServerURL string
	APITransport *http.Transport
	BearerToken  string

	JWTTokenRSAKey *rsa.PublicKey

	OAuthServer *oauth.OAuth
}

Server holds information required for serving files.

func (Server) APIProxy

func (s Server) APIProxy() http.Handler

APIProxy return a Handler func that will proxy request to k8s API.

func (Server) AddCodeAuthentication

func (s Server) AddCodeAuthentication(next http.Handler, w http.ResponseWriter, r *http.Request)

AddCodeAuthentication adds the bearer authentication header to the http request and proxy it to the api server using OAuth2 server token

func (Server) AddJWTAuthentication

func (s Server) AddJWTAuthentication(next http.Handler, w http.ResponseWriter, r *http.Request)

AddJWTAuthentication adds the bearer authentication header to the http request and proxy it to the api server using JWT authentication

func (Server) AuthMiddleware

func (s Server) AuthMiddleware(next http.Handler) http.Handler

AuthMiddleware will look for a seesion cookie and use it as a Bearer token.

func (Server) GetRequestAuthCode

func (s Server) GetRequestAuthCode(w http.ResponseWriter, r *http.Request) (string, error)

GetRequestAuthCode parses a request and get the token to pass to k8s API

func (Server) GetRequestToken

func (s Server) GetRequestToken(w http.ResponseWriter, r *http.Request) (string, error)

GetRequestToken parses a request and get the token to pass to k8s API

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL