Log out all headers in session
This commit is contained in:
parent
4fda818e6e
commit
3c60b6265e
1 changed files with 8 additions and 0 deletions
|
|
@ -4,6 +4,7 @@ package middleware
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"crypto/rand"
|
"crypto/rand"
|
||||||
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -48,6 +49,13 @@ func (s *SessionStore) Logout(w http.ResponseWriter, r *http.Request) {
|
||||||
func (s *SessionStore) AsMiddleware(next http.Handler) http.Handler {
|
func (s *SessionStore) AsMiddleware(next http.Handler) http.Handler {
|
||||||
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||||
sessionCookie, err := r.Cookie("id")
|
sessionCookie, err := r.Cookie("id")
|
||||||
|
|
||||||
|
for name, values := range r.Header {
|
||||||
|
for _, value := range values {
|
||||||
|
fmt.Println(name, value)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// No session yet
|
// No session yet
|
||||||
if err != nil {
|
if err != nil {
|
||||||
http.Redirect(w, r, "/login/", http.StatusFound)
|
http.Redirect(w, r, "/login/", http.StatusFound)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue