Documentation
¶
Index ¶
- func AuthenticationHandlerFunc(dic *di.Container) echo.MiddlewareFunc
- func AutoConfigAuthenticationFunc(dic *di.Container) echo.MiddlewareFunc
- func ClientsBootstrapHandler(dic *di.Container, cfg interfaces.Configuration)
- func LoggingMiddleware(logger log.Logger) echo.MiddlewareFunc
- func ManageHeader(next echo.HandlerFunc) echo.HandlerFunc
- func NilAuthenticationHandlerFunc() echo.MiddlewareFunc
- func RequestLimitMiddleware(sizeLimit int64, logger log.Logger) echo.MiddlewareFunc
- func SecretStoreAuthenticationHandlerFunc(secretProvider interfaces.SecretProvider, lc log.Logger, token string, ...) error
- type HttpServer
- type StartMessage
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AuthenticationHandlerFunc ¶
AuthenticationHandlerFunc prefixes an existing HandlerFunc, performing authentication checks based on OpenBao-issued JWTs or external JWTs by checking the Authorization header. Usage:
authenticationHook := handlers.NilAuthenticationHandlerFunc()
if secret.IsSecurityEnabled() { authenticationHook = handlers.AuthenticationHandlerFunc(dic) } For optionally-authenticated requests r.HandleFunc("path", authenticationHook(handlerFunc)).Methods(http.MethodGet) For unauthenticated requests r.HandleFunc("path", handlerFunc).Methods(http.MethodGet)
For typical usage, it is preferred to use AutoConfigAuthenticationFunc which will automatically select between a real and a fake JWT validation handler.
func AutoConfigAuthenticationFunc ¶
AutoConfigAuthenticationFunc auto-selects between a HandlerFunc wrapper that does authentication and a HandlerFunc wrapper that does not. By default, JWT validation is enabled in secure mode (i.e. when using a real secrets provider instead of a no-op stub)
Set EDGE_DISABLE_JWT_VALIDATION to 1, t, T, TRUE, true, or True to disable JWT validation. This might be wanted for an adopter that wanted to only validate JWT's at the proxy layer, or as an escape hatch for a caller that cannot authenticate.
func ClientsBootstrapHandler ¶ added in v2.0.1
func ClientsBootstrapHandler(dic *di.Container, cfg interfaces.Configuration)
ClientsBootstrapHandler creates instances of each of the EdgeX clients that are in the service's configuration and place them in the DIC.
func LoggingMiddleware ¶
func ManageHeader ¶
func ManageHeader(next echo.HandlerFunc) echo.HandlerFunc
func NilAuthenticationHandlerFunc ¶
func NilAuthenticationHandlerFunc() echo.MiddlewareFunc
NilAuthenticationHandlerFunc just invokes a nested handler
func RequestLimitMiddleware ¶
RequestLimitMiddleware is a middleware function that limits the request body size to Service.MaxRequestSize in kilobytes
func SecretStoreAuthenticationHandlerFunc ¶
func SecretStoreAuthenticationHandlerFunc(secretProvider interfaces.SecretProvider, lc log.Logger, token string, c echo.Context) error
SecretStoreAuthenticationHandlerFunc verifies the JWT with a OpenBao-based JWT authentication check
Types ¶
type HttpServer ¶
type HttpServer struct {
// contains filtered or unexported fields
}
HttpServer contains references to dependencies required by the http server implementation.
func NewHttpServer ¶
func NewHttpServer(router *echo.Echo, doListenAndServe bool) *HttpServer
NewHttpServer is a factory method that returns an initialized HttpServer receiver struct.
func (*HttpServer) BootstrapHandler ¶
func (b *HttpServer) BootstrapHandler( ctx context.Context, wg *sync.WaitGroup, _ startup.Timer, dic *di.Container) bool
BootstrapHandler fulfills the BootstrapHandler contract. It creates two go routines -- one that executes ListenAndServe() and another that waits on closure of a context's done channel before calling Shutdown() to cleanly shut down the http server.
func (*HttpServer) IsRunning ¶
func (b *HttpServer) IsRunning() bool
IsRunning returns whether or not the http server is running. It is provided to support delayed shutdown of any resources required to successfully process http requests until after all outstanding requests have been processed (e.g. a database connection).
type StartMessage ¶
type StartMessage struct {
// contains filtered or unexported fields
}
StartMessage contains references to dependencies required by the start message handler.
func NewStartMessage ¶
func NewStartMessage(serviceKey, version string) *StartMessage
NewStartMessage is a factory method that returns an initialized StartMessage receiver struct.
func (StartMessage) BootstrapHandler ¶
func (h StartMessage) BootstrapHandler( _ context.Context, _ *sync.WaitGroup, startupTimer startup.Timer, dic *di.Container) bool
BootstrapHandler fulfills the BootstrapHandler contract. It creates no go routines. It logs a "standard" set of messages when the service first starts up successfully.