feat: add cookie-based session support using alexedwards/scs (#1)
- Add Session wrapper with typed getters (GetString, GetInt, GetBool, etc.) - Add flash message support via Pop methods (PopString, PopInt, etc.) - Add session utilities: Exists, Keys, ID, Clear, Destroy, RenewToken - Create default session manager in New() for zero-config usage - Allow custom session manager via Options.SessionManager - Wrap mux with scs LoadAndSave middleware in Start() - Add session example demonstrating login/logout with flash messages
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
package via
|
||||
|
||||
import "github.com/alexedwards/scs/v2"
|
||||
|
||||
type LogLevel int
|
||||
|
||||
const (
|
||||
@@ -30,4 +32,9 @@ type Options struct {
|
||||
|
||||
// Plugins to extend the capabilities of the `Via` application.
|
||||
Plugins []Plugin
|
||||
|
||||
// SessionManager enables cookie-based sessions. If set, Via wraps handlers
|
||||
// with scs LoadAndSave middleware. Configure the session manager before
|
||||
// passing it (lifetime, cookie settings, store, etc).
|
||||
SessionManager *scs.SessionManager
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user