summaryrefslogtreecommitdiff
path: root/handlers/admin.go
diff options
context:
space:
mode:
authorhaturatu <taro@eyes4you.org>2025-10-13 00:08:25 +0900
committerhaturatu <taro@eyes4you.org>2025-10-13 00:08:25 +0900
commit15830af5b190cfb6f28e0bdf0f4bf110256ed9ef (patch)
treeefd3c4bdd00f8bea6df8ba2155015d18db5cfba2 /handlers/admin.go
parent6515a6fd2b2d29a8f363c906148f3abf7cf982e9 (diff)
fix(csrf): js csrf support
Diffstat (limited to 'handlers/admin.go')
-rw-r--r--handlers/admin.go8
1 files changed, 6 insertions, 2 deletions
diff --git a/handlers/admin.go b/handlers/admin.go
index 8f302c0..5614e0e 100644
--- a/handlers/admin.go
+++ b/handlers/admin.go
@@ -6,12 +6,15 @@ import (
"auth-proxy/models"
"auth-proxy/types"
"auth-proxy/worker"
+ "auth-proxy/utils"
"encoding/json"
"fmt"
"net/http"
"strconv"
"sync"
"time"
+
+ "github.com/gorilla/csrf"
)
var workerPool *types.WorkerPool
@@ -32,8 +35,9 @@ func AdminPageHandler(w http.ResponseWriter, r *http.Request) {
}
data := map[string]interface{}{
- "Paths": config.Paths,
- "Users": users,
+ "Paths": config.Paths,
+ "Users": users,
+ "CSRFToken": csrf.Token(r),
}
if err := templates.ExecuteTemplate(w, "admin.html", data); err != nil {
logging.AppLog.Error("Failed to execute admin template", "error", err)