auth/login: Add csrf protection

This commit is contained in:
Tom Wiesing 2022-12-22 15:49:06 +01:00
parent 3aa79b0d23
commit 1af9d0d83f
No known key found for this signature in database
6 changed files with 42 additions and 8 deletions

View file

@ -1,10 +1,11 @@
package auth
import (
"sync"
"net/http"
"github.com/FAU-CDI/wisski-distillery/internal/dis/component"
"github.com/FAU-CDI/wisski-distillery/internal/dis/component/sql"
"github.com/FAU-CDI/wisski-distillery/pkg/lazy"
"github.com/gorilla/sessions"
)
@ -14,8 +15,8 @@ type Auth struct {
SQL *sql.SQL
}
storeOnce sync.Once
store sessions.Store
store lazy.Lazy[sessions.Store]
csrf lazy.Lazy[func(http.Handler) http.Handler]
}
var (