Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Changeset 6342

Show
Ignore:
Timestamp:
03/06/07 04:09:14 (2 years ago)
Author:
rick
Message:

Add a #dbman attr_reader for CGI::Session and make CGI::Session::CookieStore#generate_digest public so it's easy to generate digests
using the cookie store's secret. [Rick]

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/actionpack/CHANGELOG

    r6316 r6342  
    11*SVN* 
     2 
     3# Add a #dbman attr_reader for CGI::Session and make CGI::Session::CookieStore#generate_digest public so it's easy to generate digests 
     4using the cookie store's secret. [Rick] 
    25 
    36* Added Request#url that returns the complete URL used for the request [DHH] 
  • trunk/actionpack/lib/action_controller/cgi_ext/session_performance_fix.rb

    r6174 r6342  
    2727    # Make the CGI instance available to session stores. 
    2828    attr_reader :cgi 
     29    attr_reader :dbman 
    2930    alias_method :initialize_without_cgi_reader, :initialize 
    3031    def initialize(cgi, options = {}) 
  • trunk/actionpack/lib/action_controller/session/cookie_store.rb

    r6296 r6342  
    9595  end 
    9696 
     97  # Generate the HMAC keyed message digest. Uses SHA1 by default. 
     98  def generate_digest(data) 
     99    key = @secret.respond_to?(:call) ? @secret.call(@session) : @secret 
     100    OpenSSL::HMAC.hexdigest(OpenSSL::Digest::Digest.new(@digest), key, data) 
     101  end 
     102 
    97103  private 
    98104    # Marshal a session hash into safe cookie data. Include an integrity hash. 
     
    114120    end 
    115121 
    116     # Generate the HMAC keyed message digest. Uses SHA1 by default. 
    117     def generate_digest(data) 
    118       key = @secret.respond_to?(:call) ? @secret.call(@session) : @secret 
    119       OpenSSL::HMAC.hexdigest(OpenSSL::Digest::Digest.new(@digest), key, data) 
    120     end 
    121  
    122122    # Read the session data cookie. 
    123123    def read_cookie