Add CSFR
This commit is contained in:
parent
76f1b1427f
commit
2801e4ecd3
|
@ -4,9 +4,11 @@ import (
|
|||
"magmise/controllers"
|
||||
"magmise/models"
|
||||
"net/http"
|
||||
"os"
|
||||
|
||||
"github.com/go-chi/chi/v5"
|
||||
"github.com/go-chi/chi/v5/middleware"
|
||||
"github.com/gorilla/csrf"
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
@ -20,5 +22,6 @@ func main() {
|
|||
r.Post("/user/{username}", user.Create)
|
||||
r.Post("/login", controllers.Login)
|
||||
r.Post("/logout", controllers.Logout)
|
||||
http.ListenAndServe(":8080", r)
|
||||
CSRF := csrf.Protect([]byte(os.Getenv("CSRFKEY")))
|
||||
http.ListenAndServe(":8080", CSRF(r))
|
||||
}
|
||||
|
|
|
@ -19,6 +19,7 @@ services:
|
|||
- GOPATH=/root/go
|
||||
- HASHKEY=test
|
||||
- BLOCKKEY=test
|
||||
- CSRFKEY=test
|
||||
working_dir: /api
|
||||
command: go test ./test/...
|
||||
|
||||
|
|
Loading…
Reference in New Issue