middleware/

directory
v12.1.9 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2022 License: BSD-3-Clause

README

Builtin Handlers

Middleware Example
basic authentication iris/_examples/authentication/basicauth
request logger iris/_examples/http_request/request-logger
HTTP method override iris/middleware/methodoverride/methodoverride_test.go
profiling (pprof) iris/_examples/miscellaneous/pprof
Google reCAPTCHA iris/_examples/miscellaneous/recaptcha
recovery iris/_examples/miscellaneous/recover

Community made

Most of the experimental handlers are ported to work with iris's handler form, from third-party sources.

Middleware Description Example
jwt Middleware checks for a JWT on the Authorization header on incoming requests and decodes it. iris-contrib/middleware/jwt/_example
cors HTTP Access Control. iris-contrib/middleware/cors/_example
secure Middleware that implements a few quick security wins. iris-contrib/middleware/secure/_example
tollbooth Generic middleware to rate-limit HTTP requests. iris-contrib/middleware/tollbooth/_examples/limit-handler
cloudwatch AWS cloudwatch metrics middleware. iris-contrib/middleware/cloudwatch/_example
new relic Official New Relic Go Agent. iris-contrib/middleware/newrelic/_example
prometheus Easily create metrics endpoint for the prometheus instrumentation tool iris-contrib/middleware/prometheus/_example
casbin An authorization library that supports access control models like ACL, RBAC, ABAC iris-contrib/middleware/casbin/_examples
raven Sentry client in Go raven/_example
csrf Cross-Site Request Forgery Protection csrf/_example (hard-tested for Iris) NEW
Third-Party Handlers

Iris has its own middleware form of func(ctx context.Context) but it's also compatible with all net/http middleware forms. See here.

Here's a small list of useful third-party handlers:

Middleware Description
goth OAuth, OAuth2 authentication. Example
binding Data binding from HTTP requests into structs
csp Content Security Policy (CSP) support
delay Add delays/latency to endpoints. Useful when testing effects of high latency
onthefly Generate TinySVG, HTML and CSS on the fly
permissions2 Cookies, users and permissions
RestGate Secure authentication for REST API endpoints
stats Store information about your web application (response time, etc.)
VanGoH Configurable AWS-Style HMAC authentication middleware
xrequestid Middleware that assigns a random X-Request-Id header to each request
digits Middleware that handles Twitter Digits authentication

Feel free to put up your own middleware in this list!

Directories

Path Synopsis
Package basicauth provides http basic authentication via middleware.
Package basicauth provides http basic authentication via middleware.
Package logger provides request logging via middleware.
Package logger provides request logging via middleware.
Package pprof provides native pprof support via middleware.
Package pprof provides native pprof support via middleware.
Package recover provides recovery for specific routes or for the whole app via middleware.
Package recover provides recovery for specific routes or for the whole app via middleware.

Jump to

Keyboard shortcuts

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