middleware

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2023 License: MIT Imports: 4 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BasicAuth

func BasicAuth(username, password string) health.Middleware

BasicAuth is a middleware that removes check details (such as service names, error messages, etc.) from the HTTP response on authentication failure. Authentication is performed based on basic access authentication (https://en.wikipedia.org/wiki/Basic_access_authentication).

This is useful if you want to allow the aggregated result to be visible to all clients, but provide details only to fully authenticated senders.

Attention: To be able to prevent access altogether if authentication fails, consider using an HTTP basic auth middleware instead. You can can easily use most such middleware implementations with the Handler (e.g., https://github.com/99designs/basicauth-go). This libraries middleware (health.Middleware) is only for pre- and post-processing results but not to deal with the HTTP request and response objects.

func BasicLogger

func BasicLogger() health.Middleware

BasicLogger is a basic logger that is mostly used to showcase this library.

func CustomAuth

func CustomAuth(authFunc func(r *http.Request) bool) health.Middleware

CustomAuth is a middleware that removes check details (such as service names, error messages, etc.) from the HTTP response on authentication failure. To find out if authentication was successful, the provided function will be executed (provided in argument 'authFunc').

This middleware is useful if you want to allow the aggregated result to be visible to all clients, but provide details only to fully authenticated senders.

Attention: To be able to prevent access altogether if authentication fails, consider using an HTTP basic auth middleware instead. You can can easily use most such middleware implementations with the Handler (e.g., https://github.com/99designs/basicauth-go). This libraries middleware (health.Middleware) is only for pre- and post-processing results but not to deal with the HTTP request and response objects.

func FullDetailsOnQueryParam

func FullDetailsOnQueryParam(queryParamName string) health.Middleware

FullDetailsOnQueryParam is a middleware that removes check details (such as service names, error messages, etc.) from the HTTP response unless the request contained a query parameter named like argument 'queryParamName'. If a query parameter is not present in the HTTP request, the response will only contain the aggregated health status.

Types

This section is empty.

Jump to

Keyboard shortcuts

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