Open mediafinger opened 4 years ago
Buddy, You might improve this example, posting this entire class EncryptionService
@breim My implementation of the EncryptionService turned out to be a bit too CPU intense to use it with many concurrent sessions. So, I prefer to not add it, so it won't be blindly copied.
But if you look for examples using ActiveSupport::MessageEncryptor
you will get the idea.
Hmmm interesting.
Thanks buddy ! :)
Encrypted database sessions
Hey, I would like to share my solution to how I use the gem activerecord-session_store to:
config/initializers/session_store.rb
app/models/session.rb
The
EncryptionService
used in this example is a small class based on ActiveSupport::MessageEncryptordatabase schema
The index on the
updated_at
column is there to delete sessions older than 30 days by runningrake db:sessions:trim
as a scheduled task.Hope it helps!
By going through the issues here and while trying to implement this solution, I've got the impression that the documentation of this gem is outdated and lacking. Maybe this implementation helps someone to achieve something similar faster than me.