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