-
-
Notifications
You must be signed in to change notification settings - Fork 117
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
Session id is being found as empty string #108
Comments
It could be nil rather than empty: After debugging a sign in:
I tried this on console
And got nil... But maybe debugging the cache through the console doesn't access the same cache than the application? |
Re debugging the cache through the console, my guess would be that you're not starting the console in the same environment as the app is running in. If this is production, make sure to do |
Hi Nat, I have just runned console in production mode and still cannot find the key: Another example:
And since it doesn't find the id it is not deleting the record on the DB. What do you think might be happening? Maybe cache is not being written? |
Could this be related to the fact that some sessions do not have a "complete" data property? Ex (First one with maybe incomplete data property):
|
Can this issue may be related to the fact that I have multiple instances running on heroku? |
I don't think it is because of the incomplete data property; the code to delete sessions doesn't even look at the data. It could be related to multiple instances, if each instance is connected to a different memcached instance. |
Nat, I reduced the instances to one (I had one app with 18 and another with 12) and the problem was solved. Many thanks. |
I would recommend switching to the ActiveRecord-based session store: https://github.com/rails/activerecord-session_store This will store all session data in the database so you can be sure it's in one central location. |
Yes, I'm using that! session_store.rb:
But I think that the gem stores the tuple in caché (cas_server_session_ticket, internal_application_ticket) even when using active record session store. Take a look at my 5th comment of this thread (ActiveRecord::SessionStore):
|
Ah, yes, you're right - sorry, I'd been conflating session storage with single sign-out storage strategy. The storage strategy is what's to blame here: it takes care of storing the mapping between CAS users and sessions. The only built-in one uses the Rails cache; hence why going from 12 to 1 instances fixed it. In theory, it should be possible to implement your own strategy that uses ActiveRecord instead. You'll need a new table for this, but it doesn't have to be very complicated. For a baseline implementation, see how the cache strategy does it: https://github.com/nbudin/devise_cas_authenticatable/blob/master/lib/devise_cas_authenticatable/single_sign_out/strategies/rails_cache.rb Once you have implemented an ActiveRecord strategy, you could then configure it using the |
Ok, I'm doing this today. |
Hi Nat,
After CAS emits the single sign out signal, some client apps (2/4) display the following log:
Please take a look where it says "Found session id for index". It seems that this line (
devise_cas_authenticatable/lib/devise_cas_authenticatable/single_sign_out/strategies/rails_cache.rb
Line 12 in 26b2d82
The text was updated successfully, but these errors were encountered: