Parent

Files

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 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 588
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 601
def load
  begin
    File.open(filename, 'r') do |f|
      Marshal.load f.read
    end
  rescue Errno::ENOENT
    {}
  end
end
save(data) click to toggle source

Associates the new data to the session and removes the old

# File lib/httpauth/digest.rb, line 594
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 614
def filename
  "#{options[:tmpdir] || Dir::tmpdir}/ruby_digest_cache.#{self.opaque}"
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.