This commit is contained in:
2024-12-05 23:37:20 +01:00
parent fe2d7c0fd4
commit 778033e494
3 changed files with 10 additions and 6 deletions

View File

@@ -28,6 +28,15 @@ func Authenticate(service service.Auth) func(http.Handler) http.Handler {
}
}
func GetSession(r *http.Request) *service.Session {
obj := r.Context().Value(SessionKey)
if obj == nil {
return nil
}
return obj.(*service.Session)
}
func getSessionID(r *http.Request) string {
cookie, err := r.Cookie("id")
if err != nil {