Documentation
¶
Index ¶
- func CORS(cfg *config.Config) echo.MiddlewareFunc
- func CSP(cfg *config.Config) echo.MiddlewareFunc
- func CacheControl(maxAge time.Duration) echo.MiddlewareFunc
- func Config(cfg *config.Config) echo.MiddlewareFunc
- func HealthCheck(cfg *config.Config) echo.MiddlewareFunc
- func LoadAuthenticatedUser(authClient *services.AuthClient) echo.MiddlewareFunc
- func LoadUser(orm *ent.Client) echo.MiddlewareFunc
- func LoadValidPasswordToken(authClient *services.AuthClient) echo.MiddlewareFunc
- func LogRequest() echo.MiddlewareFunc
- func Metrics(cfg *config.Config) echo.MiddlewareFunc
- func RateLimit(cfg *config.Config) echo.MiddlewareFunc
- func RequestLogging(cfg *config.Config) echo.MiddlewareFunc
- func RequireAdmin(next echo.HandlerFunc) echo.HandlerFunc
- func RequireAuthentication(next echo.HandlerFunc) echo.HandlerFunc
- func RequireNoAuthentication(next echo.HandlerFunc) echo.HandlerFunc
- func RequireVerification(next echo.HandlerFunc) echo.HandlerFunc
- func ResponseCache(config ResponseCacheConfig) echo.MiddlewareFunc
- func Session(store sessions.Store) echo.MiddlewareFunc
- func SetLogger() echo.MiddlewareFunc
- type CachedResponse
- type ResponseCacheConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CORS ¶
func CORS(cfg *config.Config) echo.MiddlewareFunc
CORS returns a CORS middleware configured from the application configuration.
func CSP ¶
func CSP(cfg *config.Config) echo.MiddlewareFunc
CSP returns a Content Security Policy middleware configured from the application configuration.
func CacheControl ¶
func CacheControl(maxAge time.Duration) echo.MiddlewareFunc
CacheControl sets a Cache-Control header with a given max age.
func Config ¶
func Config(cfg *config.Config) echo.MiddlewareFunc
Config stores the configuration in the request so it can be accessed by the ui.
func HealthCheck ¶
func HealthCheck(cfg *config.Config) echo.MiddlewareFunc
HealthCheck returns a health check middleware that responds to health check requests.
func LoadAuthenticatedUser ¶
func LoadAuthenticatedUser(authClient *services.AuthClient) echo.MiddlewareFunc
LoadAuthenticatedUser loads the authenticated user, if one, and stores in context.
func LoadUser ¶
func LoadUser(orm *ent.Client) echo.MiddlewareFunc
LoadUser loads the user based on the ID provided as a path parameter.
func LoadValidPasswordToken ¶
func LoadValidPasswordToken(authClient *services.AuthClient) echo.MiddlewareFunc
LoadValidPasswordToken loads a valid password token entity that matches the user and token provided in path parameters If the token is invalid, the user will be redirected to the forgot password route This requires that the user owning the token is loaded in to context.
func LogRequest ¶
func LogRequest() echo.MiddlewareFunc
LogRequest logs the current request Echo provides middleware similar to this, but we want to use our own logger
func Metrics ¶
func Metrics(cfg *config.Config) echo.MiddlewareFunc
Metrics returns a metrics middleware that responds to metrics requests.
func RateLimit ¶
func RateLimit(cfg *config.Config) echo.MiddlewareFunc
RateLimit returns a rate limiting middleware configured from the application configuration.
func RequestLogging ¶
func RequestLogging(cfg *config.Config) echo.MiddlewareFunc
RequestLogging returns a request logging middleware configured from the application configuration.
func RequireAdmin ¶
func RequireAdmin(next echo.HandlerFunc) echo.HandlerFunc
RequireAdmin requires that the authenticated user be an admin in order to proceed.
func RequireAuthentication ¶
func RequireAuthentication(next echo.HandlerFunc) echo.HandlerFunc
RequireAuthentication requires that the user be authenticated in order to proceed.
func RequireNoAuthentication ¶
func RequireNoAuthentication(next echo.HandlerFunc) echo.HandlerFunc
RequireNoAuthentication requires that the user not be authenticated in order to proceed.
func RequireVerification ¶
func RequireVerification(next echo.HandlerFunc) echo.HandlerFunc
RequireVerification requires that the authenticated user be verified in order to proceed.
func ResponseCache ¶
func ResponseCache(config ResponseCacheConfig) echo.MiddlewareFunc
ResponseCache returns a middleware that caches HTTP responses
func Session ¶
func Session(store sessions.Store) echo.MiddlewareFunc
Session sets the session storage in the request context
func SetLogger ¶
func SetLogger() echo.MiddlewareFunc
SetLogger initializes a logger for the current request and stores it in the context. It's recommended to have this executed after Echo's RequestID() middleware because it will add the request ID to the logger so that all log messages produced from this request have the request ID in it. You can modify this code to include any other fields that you want to always appear.