Parent

Class Index [+]

Quicksearch

Rack::Auth::Digest::Nonce

Rack::Auth::Digest::Nonce is the default nonce generator for the Rack::Auth::Digest::MD5 authentication handler.

private_key needs to set to a constant string.

time_limit can be optionally set to an integer (number of seconds), to limit the validity of the generated nonces.

Attributes

private_key[RW]

(Not documented)

time_limit[RW]

(Not documented)

Public Class Methods

new(timestamp = Time.now, given_digest = nil) click to toggle source

(Not documented)

    # File lib/rack/auth/digest/nonce.rb, line 24
24:         def initialize(timestamp = Time.now, given_digest = nil)
25:           @timestamp, @given_digest = timestamp.to_i, given_digest
26:         end
parse(string) click to toggle source

(Not documented)

    # File lib/rack/auth/digest/nonce.rb, line 20
20:         def self.parse(string)
21:           new(*string.unpack("m*").first.split(' ', 2))
22:         end

Public Instance Methods

digest() click to toggle source

(Not documented)

    # File lib/rack/auth/digest/nonce.rb, line 32
32:         def digest
33:           ::Digest::MD5.hexdigest([ @timestamp, self.class.private_key ] * ':')
34:         end
fresh?() click to toggle source

(Not documented)

    # File lib/rack/auth/digest/nonce.rb, line 44
44:         def fresh?
45:           !stale?
46:         end
stale?() click to toggle source

(Not documented)

    # File lib/rack/auth/digest/nonce.rb, line 40
40:         def stale?
41:           !self.class.time_limit.nil? && (@timestamp - Time.now.to_i) < self.class.time_limit
42:         end
to_s() click to toggle source

(Not documented)

    # File lib/rack/auth/digest/nonce.rb, line 28
28:         def to_s
29:           [([ @timestamp, digest ] * ' ')].pack("m*").strip
30:         end
valid?() click to toggle source

(Not documented)

    # File lib/rack/auth/digest/nonce.rb, line 36
36:         def valid?
37:           digest == @given_digest
38:         end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.