Class: HTTPAuth::Digest::Session
- Inherits:
-
Object
- Object
- HTTPAuth::Digest::Session
- Defined in:
- lib/httpauth/digest.rb
Overview
Session is a file-based session implementation for storing details about the Digest authentication session between requests.
Instance Attribute Summary collapse
-
#opaque ⇒ Object
Returns the value of attribute opaque.
-
#options ⇒ Object
Returns the value of attribute options.
Instance Method Summary collapse
-
#initialize(opaque, options = {}) ⇒ Session
constructor
Initializes the new Session object.
-
#load ⇒ Object
Returns the data from this session.
-
#save(data) ⇒ Object
Associates the new data to the session and removes the old.
Constructor Details
#initialize(opaque, options = {}) ⇒ Session
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.
-
588 589 590 591 |
# File 'lib/httpauth/digest.rb', line 588 def initialize(opaque, ={}) self.opaque = opaque self. = end |
Instance Attribute Details
#opaque ⇒ Object
Returns the value of attribute opaque.
579 580 581 |
# File 'lib/httpauth/digest.rb', line 579 def opaque @opaque end |
#options ⇒ Object
Returns the value of attribute options.
580 581 582 |
# File 'lib/httpauth/digest.rb', line 580 def @options end |
Instance Method Details
#load ⇒ Object
Returns the data from this session
601 602 603 604 605 606 607 608 609 |
# 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) ⇒ Object
Associates the new data to the session and removes the old
594 595 596 597 598 |
# File 'lib/httpauth/digest.rb', line 594 def save(data) File.open(filename, 'w') do |f| f.write Marshal.dump(data) end end |