class HTTPAuth::Digest::Session
Session is a file-based session implementation for storing details about the Digest authentication session between requests.
Attributes
opaque[RW]
options[RW]
Public Class Methods
new(opaque, options = {})
click to toggle source
Initializes the new Session object.
-
opaque
- A string to identify the session. This would normally be theopaque
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
Public Instance Methods
load()
click to toggle source
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
save(data)
click to toggle source
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
Protected Instance Methods
filename()
click to toggle source
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