Session is a file-based session implementation for storing details about the Digest authentication session between requests.
Initializes the new Session object.
opaque
- A string to identify the session. This would normally
be the opaque
sent by the client, but it could also be an
identifier sent through a different mechanism.
options
- Additional options
:tmpdir
A tempory directory for storing the session data.
Dir::tmpdir is the default.
# File lib/httpauth/digest.rb, line 589 def initialize(opaque, options = {}) self.opaque = opaque self.options = options end
Returns the data from this session
# File lib/httpauth/digest.rb, line 602 def load File.open(filename, 'r') do |f| Marshal.load f.read end rescue Errno::ENOENT {} end
Associates the new data to the session and removes the old
# File lib/httpauth/digest.rb, line 595 def save(data) File.open(filename, 'w') do |f| f.write Marshal.dump(data) end end
The filename from which the session will be saved and read from
# File lib/httpauth/digest.rb, line 613 def filename "#{options[:tmpdir] || Dir.tmpdir}/ruby_digest_cache.#{opaque}" end