proxy

package
v0.3.0-alpha.1 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2019 License: MIT Imports: 12 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 {
	Addr              string
	SecretKey         []byte
	SessionCookieName string
	Upstream          *url.URL
}

Server implements a simple reverse proxy server authenticating on AWS IAM

func (*Server) Health

func (s *Server) Health(w http.ResponseWriter, r *http.Request)

Health returns a successful health check

func (*Server) ListenAndServe

func (s *Server) ListenAndServe() error

ListenAndServer starts the HTTP server. This server respects SIGINT and will gracefully shutdown.

func (*Server) Login

func (s *Server) Login(w http.ResponseWriter, r *http.Request)

login validates basic auth of username and secret+mfa on AWS IAM and sets cookie with session jwt

func (*Server) Logout

func (s *Server) Logout(w http.ResponseWriter, r *http.Request)

logout kills cookie and redirect to /

func (*Server) Proxy

func (s *Server) Proxy(w http.ResponseWriter, r *http.Request)

proxy request to upstream with net/http/httputil.SingleHostReverseProxy

func (*Server) ServeHTTP

func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request)

write mainServeHTTP that validates token and route to appropriate serve method valid token: proxy to upstream. invalid token redirect to login

Jump to

Keyboard shortcuts

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