Middleware guides
Middleware - BearerAuth
Detailed guide to Kern Bearer token authentication middleware with default and configurable validation paths.
Kern.BearerAuth and Kern.BearerAuthWithConfig
Use bearer auth middleware for simple token-protected APIs.
Signatures
func BearerAuth(token string) MiddlewareFunc
func BearerAuthWithConfig(config BearerAuthConfig) MiddlewareFuncBasic example
app.Use(kern.BearerAuth("super-secret-token"))Route-group example
api := app.Group("/api")
api.Use(kern.BearerAuth("super-secret-token"))Notes
- Prefer TLS for all token-protected routes.
- For claim-based auth, use
middleware.JWTfrom optional middleware package.