Documentation
¶
Index ¶
Constants ¶
const ( AUTHORIZATION string = "Authorization" HEADER_USER_NAME string = "User-Name" HEADER_CUSTOMER_ID string = "Customer-Id" HEADER_USER_ID string = "User-Id" HEADER_SERVICE_ID string = "Service-Id" HEADER_INPUT_APP string = "x-application-vkn" HEADER_APP_ID string = "App-Id" HEADER_REMOTE_IP string = "Remote-Ip" HEADER_REQUEST_WEIGHT_NAME string = "x-application-rw" HEADER_REQUEST_WEIGHT_VALUE string = "x-application-rv" HEADER_TIMESTAMP string = "x-application-alo" HEADER_PLAN_ID string = "Plan-Id" HEADER_PLAN_IPFS_STORAGE string = "Plan-Storage" HEADER_IPFS_STORAGE string = "Ipfs-Storage" HEADER_JTI string = "jti" )
const ( INSUFFICIENT_SCOPE_ERROR string = "INSUFFICIENT_SCOPE_ERROR" USER_AGENT_CHANGED string = "USER_AGENT_CHANGE" INVALID_TOKEN_ERROR string = "INVALID_TOKEN_ERROR" INVALID_APP_ID string = "INVALID_APP_ID" INVALID_CUSTOMER_ID string = "INVALID_CUSTOMER_ID" PARAM_NETWORK_ID string = "network" PARAM_OFFSET string = "o" PARAM_MAX_ROWS string = "n" CORE_VIEW_WEIGHT_NAME_DEFAULT string = "CORE_VIEW" CORE_VIEW_WEIGHT_VALUE_DEFAULT string = "1" )
Variables ¶
This section is empty.
Functions ¶
func LaunchMemStats ¶
func LaunchMemStats()
func NewElapsedTimeInterceptor ¶
func NewElapsedTimeInterceptor() mux.MiddlewareFunc
Intercepts the request and calculates the total run time from start to finish
Types ¶
type ErrorDTO ¶
type ErrorDTO struct { // The error code // in: string Code string `json:"code"` // The error message // in: string Message string `json:"message"` }
func NewErrorDTO ¶
NewErrorDTO returns a new ErrorDTO
type MiddlewareChain ¶
type MiddlewareChain []MiddlewareInterceptor
MiddlewareChain is a collection of interceptors that will be invoked in there index order
func (MiddlewareChain) Handler ¶
func (chain MiddlewareChain) Handler(handler http.HandlerFunc) http.Handler
Handler allows hooking multiple middleware in single call.
type MiddlewareHandlerFunc ¶
type MiddlewareHandlerFunc http.HandlerFunc
MiddlewareHandlerFunc builds on top of http.HandlerFunc, and exposes API to intercept with MiddlewareInterceptor. This allows building complex long chains without complicated struct manipulation
func (MiddlewareHandlerFunc) Intercept ¶
func (cont MiddlewareHandlerFunc) Intercept(mw MiddlewareInterceptor) MiddlewareHandlerFunc
Intercept returns back a continuation that will call install middleware to intercept the continuation call.
type MiddlewareInterceptor ¶
type MiddlewareInterceptor func(http.ResponseWriter, *http.Request, http.HandlerFunc)
MiddlewareInterceptor intercepts an HTTP handler invocation, it is passed both response writer and request which after interception can be passed onto the handler function.
func TimestampHeaderInterceptor ¶
func TimestampHeaderInterceptor() MiddlewareInterceptor
type RoleValidator ¶
type RoleValidator func(request *http.Request, customerInfo *jwt.CustomerInfo) bool
Interface used to execute SecurityTokenInterceptor url filtering for authorization
type ServiceConfig ¶
ServiceConfig contains the ServiceID and Environment values of the application that uses Middleware to secure access to endpoints.
func (*ServiceConfig) JwtInterceptor ¶
func (config *ServiceConfig) JwtInterceptor(roleValidator RoleValidator, dbTokenValidator jwt.DBTokenValidator) MiddlewareInterceptor
JwtInterceptor Executes all operations necessary to validate that the token received contains the credentials required for the request. Receives as parameter RoleValidator from the applica