// AuthenticityTokenFilter sets the authenticity token on the context and on the cookie func AuthenticityTokenFilter(c router.Context) error { token, err := auth.AuthenticityToken(c.Writer(), c.Request()) if err != nil { return err } c.Set(auth.SessionTokenKey, token) return nil }
// CurrentUserFilter returns a filter function which sets the current user on the context func CurrentUserFilter(c router.Context) error { u := CurrentUser(c) c.Set("current_user", u) return nil }