class ActiveSupport::LegacyKeyGenerator
:nodoc:
def ensure_secret_secure(secret)
To prevent users from using something insecure like "Password" we make sure that the
def ensure_secret_secure(secret) if secret.blank? raise ArgumentError, "A secret is required to generate an " + "integrity hash for cookie session data. Use " + "config.secret_key_base = \"some secret phrase of at " + "least #{SECRET_MIN_LENGTH} characters\"" + "in config/initializers/secret_token.rb" end if secret.length < SECRET_MIN_LENGTH raise ArgumentError, "Secret should be something secure, " + "like \"#{SecureRandom.hex(16)}\". The value you " + "provided, \"#{secret}\", is shorter than the minimum length " + "of #{SECRET_MIN_LENGTH} characters" end end
def generate_key(salt)
def generate_key(salt) @secret end
def initialize(secret)
def initialize(secret) ensure_secret_secure(secret) @secret = secret end