gateway

package
v0.0.0-...-3a7571d Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2021 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// define custom errors returned by application
	ErrInvalidJWToken     = errors.New("Invalid JWToken")
	ErrInvalidTokenSchema = errors.New("Invalid Token Schema")
	ErrInvalidAuthHeader  = errors.New("Invalid authorization header")
)
View Source
var (
	// define custom errors
	ErrInvalidModule = errors.New("Module does not exist")
	ErrModuleExists  = errors.New("Module already exists")
)

Functions

func JWTMiddleware

func JWTMiddleware(jwtSecret string, adminOnly bool) gin.HandlerFunc

middleware used to parse JWTokens from request

func NewAPIGateway

func NewAPIGateway(jwtSecret string) *gin.Engine

function used to generate new API gateway service

func NewGatewayAdminAPI

func NewGatewayAdminAPI(secret string, tokenExpiry int) *gin.Engine

function used to generate new API gateway admin service

func SetCorsHeaders

func SetCorsHeaders(response http.ResponseWriter, request *http.Request)

function used to set CORS headers on incoming requests

func SetProxyHeaders

func SetProxyHeaders(request *http.Request, url *url.URL)

function used to set proxy headers headers on request

Types

type GraphPersistence

type GraphPersistence struct {
	*utils.BaseGraphAccessor
}

func NewGraphPersistence

func NewGraphPersistence(host string, port int,
	username, password string) (*GraphPersistence, error)

func SetGraphPersistence

func SetGraphPersistence(host string, port int,
	username, password string) *GraphPersistence

function used to set new instance of graph persistence for global variables to use

func (*GraphPersistence) AddModule

func (db *GraphPersistence) AddModule(module Module) error

function used to add a new module to the graph. note that all module lables are constrained so that the module name must be unique to avoid duplicate modules

func (*GraphPersistence) GetModuleDetails

func (db *GraphPersistence) GetModuleDetails(name string) (Module, error)

function used to retrieve module details from graph

type JWTClaims

type JWTClaims struct {
	Uid   string `json:"uid"`
	Admin bool   `json:"admin"`
	jwt.StandardClaims
}

type Module

type Module struct {
	ModuleName        string `json:"module_name" validate:"required"`
	ModuleRedirect    string `json:"module_redirect" validate:"required"`
	TrimAppName       bool   `json:"trim_app_name" validate:"required"`
	ModuleDescription string `json:"module_description" validate:"required"`
}

Jump to

Keyboard shortcuts

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