In a Rails 7 app with session_store: :cache_store, I need to set the session id from the sid attribute of a JWT instead of the value of the session cookie (I can't use cookies).
I have been able to extract the JWT's sid. I need a way to set the incoming session cookie to that sid, so that is is used a as the session id of the request. The session data will be saved in th cache store, not in the session cookie.
Is there a way to intercept the request and set the cookie using middleware, so that it can be used seamlessly in the ActionDispatch::Session::CacheStore middleware downstream?