server

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2020 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetContext

func SetContext(req *http.Request, gastonContext *GastonContext) *http.Request

SetContext sets context to http.Request

Types

type GastonContext

type GastonContext struct {
	Roles   []string
	Headers map[string][]string
}

GastonContext keeps and collects infomation for Requests

func GetContext

func GetContext(req *http.Request) *GastonContext

GetContext returns context from http.Request

type GastonContextKey

type GastonContextKey struct{}

GastonContextKey is the key for http context

type JWTAuthorizationConfig

type JWTAuthorizationConfig struct {
	Header            string
	Scheme            string
	HmacSecret        string
	RolesClaim        string
	UserClaim         string
	RemoteUserHeader  string
	RemoteRolesHeader string
}

JWTAuthorizationConfig stores config

type Middleware

type Middleware func(next http.Handler) http.Handler

Middleware returns request handlers

func NewJWTAuthorizationMiddleware

func NewJWTAuthorizationMiddleware(config JWTAuthorizationConfig) Middleware

NewJWTAuthorizationMiddleware returns Middleware to handle JWT tokens

type Server

type Server struct {
	Remote remote.Remote
	// contains filtered or unexported fields
}

Server stores Remote and middlewares

func (*Server) ServeHTTP

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

func (*Server) Use

func (s *Server) Use(m Middleware)

Use wraps request handler into Middleware

Jump to

Keyboard shortcuts

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