-
Notifications
You must be signed in to change notification settings - Fork 56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Disable session cookie / alternate session implmentation #100
Comments
Let's say: It depends :-) If you use the If you use the |
Thanks. I did switch to Spock-core using a Checking again it must of been a Firefox issue, the cookie is no longer appearing. Verifying with I am new to Haskell / Spock, happy to contribute where I can if you have any implementation suggestions. Not knowing to much it might be possible using the existing
|
Actually, the current Spock/Spock/src/Web/Spock/Internal/SessionManager.hs Lines 43 to 50 in 138198f
SessionManager into two (or three) types otherwise the type will not represent the semantics (i.E. sm_mapSessions can not be implemented for client side sessions.) We will also need to track if we use client or server side sessions in the sess parameter somehow we carry around to call/expose the functions to the end user. So to start we'd need to split the type for example like so:
data BaseSessionManager m conn sess st
= BaseSessionManager
{ bsm_getSessionId :: m SessionId
, bsm_getCsrfToken :: m T.Text
, bsm_regenerateSessionId :: m ()
, bsm_readSession :: m sess
, bsm_writeSession :: sess -> m ()
, bsm_modifySession :: forall a. (sess -> (sess, a)) -> m a
, bsm_middleware :: Middleware
} data ServerSessionManager m conn sess st
= ServerSessionManager
{ ssm_base :: m (BaseSessionManager m conn sess st)
, ssm_mapSessions :: (forall n. Monad n => sess -> n sess) -> m ()
, ssm_clearAllSessions :: MonadIO m => m ()
, ssm_closeSessionManager :: IO ()
} data ClientSessionManager m conn sess st
= ClientSessionManager
{ csm_base :: m (BaseSessionManager m conn sess st)
, -- what do we need apart from that?
} All session values would then be wrapped with either The functions in https://github.com/agrafix/Spock/blob/138198fa5e50d7238bfecc64678403aadc80fc37/Spock/src/Web/Spock/SessionActions.hs would then move to type classes What do you think? |
Two questions.
Is it possible to disable Spock from creating the
spockcookie
session cookie? I can see it's created with Wai middleware but can't an easy way to disable it.This leads on from I want to use a encrypted cookie to store sessions and not use a remote session store.
I currently create a encrypted session cookie on a callback from Auth0 with a expiry field in the cookie, user id, name and roles. The expiry is low, each request returns a new session cookie with expiry incremented creating a sliding session.
I can see the backend session storage is plugable but no way to disable backend storage and use a client side implementation? Is anything on the roadmap to allow this?
The text was updated successfully, but these errors were encountered: