Class: Mack::Utils::AuthenticityTokenDispenser

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/mack/utils/forgery_detector.rb

Overview

:nodoc:

Instance Method Summary collapse

Instance Method Details

#dispense_token(key) ⇒ Object

:nodoc:



144
145
146
147
148
149
# File 'lib/mack/utils/forgery_detector.rb', line 144

def dispense_token(key) # :nodoc:
  salt = configatron.mack.retrieve(:request_authenticity_token_salt, "shh, it's a secret")
  salt = "shh, it's a secret" if salt.empty?
  string_to_hash = key.to_s + salt.to_s
  Digest::SHA1.hexdigest(string_to_hash)
end