Class HTTPAuth::Digest::Session
In: lib/httpauth/digest.rb
Parent: Object

Session is a file-based session implementation for storing details about the Digest authentication session between requests.

Methods

filename   load   new   save  

Attributes

opaque  [RW] 
options  [RW] 

Public Class methods

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.

[Source]

     # File lib/httpauth/digest.rb, line 552
552:       def initialize(opaque, options={})
553:         self.opaque = opaque
554:         self.options = options
555:       end

Public Instance methods

Returns the data from this session

[Source]

     # File lib/httpauth/digest.rb, line 565
565:       def load
566:         begin
567:           File.open(filename, 'r') do |f|
568:             Marshal.load f.read
569:           end
570:         rescue Errno::ENOENT
571:           {}
572:         end
573:       end

Associates the new data to the session and removes the old

[Source]

     # File lib/httpauth/digest.rb, line 558
558:       def save(data)
559:         File.open(filename, 'w') do |f|
560:           f.write Marshal.dump(data)
561:         end
562:       end

Protected Instance methods

The filename from which the session will be saved and read from

[Source]

     # File lib/httpauth/digest.rb, line 578
578:       def filename
579:         "#{options[:tmpdir] || Dir::tmpdir}/ruby_digest_cache.#{self.opaque}"
580:       end

[Validate]