refactoring: better way to handle authentication
refactoring: better way to handle authentication

the cookie setting and reading is synchronized to avoid some weird
concurrency problems if several threads share the same session (user
should be using actors anyway, but how knows...)

gnieh/sohva,gnieh/sohva,gnieh/sohva