Documentation
¶
Index ¶
- type Middleware
- func (m *Middleware) Authenticate(next http.Handler) http.Handler
- func (m *Middleware) CsrfToken(next http.Handler) http.Handler
- func (m *Middleware) Headers(next http.Handler) http.Handler
- func (m *Middleware) Logging(next http.Handler) http.Handler
- func (m *Middleware) LoginRequired(next http.Handler) http.Handler
- func (m *Middleware) Recover(next http.Handler) http.Handler
- func (m *Middleware) RedirectAuthenticatedUsers(next http.Handler) http.Handler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Middleware ¶
type Middleware struct {
// contains filtered or unexported fields
}
func NewMiddleware ¶
func NewMiddleware(app *app.App) *Middleware
NewMiddleware initializes and returns a new Middleware instance, associating it with the provided app.App instance.
func (*Middleware) Authenticate ¶
func (m *Middleware) Authenticate(next http.Handler) http.Handler
Authenticate is middleware that ensures incoming requests are associated with a valid authenticated user.
func (*Middleware) CsrfToken ¶
func (m *Middleware) CsrfToken(next http.Handler) http.Handler
CsrfToken is middleware that applies CSRF protection to HTTP requests using nosurf, setting a secure base cookie.
func (*Middleware) Headers ¶
func (m *Middleware) Headers(next http.Handler) http.Handler
Headers is an HTTP middleware that sets various security-related headers for incoming requests.
func (*Middleware) Logging ¶
func (m *Middleware) Logging(next http.Handler) http.Handler
Logging is an HTTP middleware that logs details of incoming requests, including IP, protocol, method, and URL.
func (*Middleware) LoginRequired ¶
func (m *Middleware) LoginRequired(next http.Handler) http.Handler
LoginRequired is middleware that enforces user authentication by redirecting unauthenticated requests to the login page.
func (*Middleware) Recover ¶
func (m *Middleware) Recover(next http.Handler) http.Handler
Recover is a middleware that intercepts panics, logs the error via ServerError, and responds with a 500 status.
func (*Middleware) RedirectAuthenticatedUsers ¶
func (m *Middleware) RedirectAuthenticatedUsers(next http.Handler) http.Handler
RedirectAuthenticatedUsers is middleware that redirects authenticated users away from login or register pages to /events.