Middleware guides
Middleware - CSRF
Detailed guide to middleware.CSRF for double-submit token protection on browser-based state-changing routes.
middleware.CSRF
Protects state-changing requests using double-submit CSRF token strategy.
Signature
func CSRF(configs ...CSRFConfig) kern.MiddlewareFuncExample
import "github.com/mobentum/kern/middleware"
app.Use(middleware.CSRF())Notes
- Use on session/cookie-authenticated browser routes.
- For pure token-based APIs without cookies, CSRF is usually unnecessary.