It is possible, though kind of discouraged.
Solution
You can't simply store it globally because there is not such thing as "global" session - it is always specific to request context. Even having globals thread-local by default in D does not help as multiple fibers share same execution thread.
For such tasks vibe.d provides TaskLocal template which allows to do exactly what you want. I have not tried it but expect TaskLocal!Session session
to "just work".
Please pay attention to these two warnings from docs:
Note, however, that each TaskLocal variable will increase the memory footprint of any task that uses task local storage. There is also an overhead to access TaskLocal variables, higher than for thread local variables, but generally still O(1)
and
FiberLocal instances MUST be declared as static/global thread-local variables. Defining them as a temporary/stack variable will cause crashes or data corruption!
Objection
Based on my experience, however, it still better to pass all such context explicitly through despite small typing inconvenience. Using globals is discouraged for a reason - as your program size grows it becomes inevitably hard to track dependencies between modules and test such code. Falling to convenience temptation now may cause lot of headache later. To minimize extra typing and simplify code maintenance I may suggest to instead define struct Context { ...}
which will contain request / session pointers and will be routinely passed around instead.