control: Generalize cookie and csrf handling
This commit is contained in:
parent
eb17dbe33f
commit
34bdb3cf24
15 changed files with 122 additions and 44 deletions
|
|
@ -19,14 +19,18 @@ type Auth struct {
|
|||
}
|
||||
|
||||
store lazy.Lazy[sessions.Store]
|
||||
csrf lazy.Lazy[func(http.Handler) http.Handler]
|
||||
}
|
||||
|
||||
var (
|
||||
_ component.Routeable = (*Auth)(nil)
|
||||
)
|
||||
|
||||
func (auth *Auth) Routes() []string { return []string{"/auth/"} }
|
||||
func (auth *Auth) Routes() component.Routes {
|
||||
return component.Routes{
|
||||
Paths: []string{"/auth/"},
|
||||
CSRF: true,
|
||||
}
|
||||
}
|
||||
|
||||
func (auth *Auth) HandleRoute(ctx context.Context, route string) (http.Handler, error) {
|
||||
router := httprouter.New()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue