Created
December 12, 2017 14:23
-
-
Save trueheart78/784c8d003ed84ebccb3f6bb3e6f81e74 to your computer and use it in GitHub Desktop.
64 Digit Session ID for Rails
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# config/initializers/01_session_security.rb | |
module SessionSecurity | |
def generate_sid | |
sid = SecureRandom.hex(32) | |
sid.encode!(Encoding::UTF_8) | |
sid | |
end | |
end | |
ActionDispatch::Session::AbstractStore.include SessionSecurity |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment