diff options
| author | haturatu <taro@eyes4you.org> | 2025-10-12 18:52:35 +0900 |
|---|---|---|
| committer | haturatu <taro@eyes4you.org> | 2025-10-12 18:52:35 +0900 |
| commit | 0cf0d195218fc289f2a04db5535d8fbbd96c988c (patch) | |
| tree | e5d1911b7e0aae157b3cd93719a4f547ca88a965 /middleware/auth.go | |
| parent | 957dc75eddf69ccf26bd387828b9e205a5425f30 (diff) | |
add: php support
- ja doc
Diffstat (limited to 'middleware/auth.go')
| -rw-r--r-- | middleware/auth.go | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/middleware/auth.go b/middleware/auth.go index 45fa864..e4f096b 100644 --- a/middleware/auth.go +++ b/middleware/auth.go @@ -52,7 +52,10 @@ func SessionAuth(next http.Handler) http.Handler { return } + // Add user info to context and headers for downstream handlers ctx := context.WithValue(r.Context(), types.SessionDataContextKey, user) + r.Header.Set("X-Username", user.Username) + r.Header.Set("X-User-Role", user.Role) next.ServeHTTP(w, r.WithContext(ctx)) }) } @@ -151,4 +154,4 @@ func AdminMiddleware(next http.Handler) http.Handler { logging.SecurityLog.Info("ADMIN ACCESS GRANTED", "user", user.Username, "path", r.URL.Path, "ip", ip) next.ServeHTTP(w, r) }) -} +}
\ No newline at end of file |
