class HTTP::AuthChallenge

A parsed WWW-Authenticate header

Attributes

params[RW]

The authentication parameters

scheme[RW]

The authentication scheme

Public Instance Methods

[](param) click to toggle source

Retrieves param from the params list

# File lib/mechanize/http/auth_challenge.rb, line 31
def [] param
  params[param]
end
initialize(scheme = nil, params = nil) click to toggle source

Creates a new AuthChallenge header with the given scheme and parameters

# File lib/mechanize/http/auth_challenge.rb, line 28
    
realm(uri) click to toggle source

Constructs an AuthRealm for this challenge

# File lib/mechanize/http/auth_challenge.rb, line 38
def realm uri
  case scheme
  when 'Basic' then
    raise ArgumentError, "provide uri for Basic authentication" unless uri
    Mechanize::HTTP::AuthRealm.new scheme, uri + '/', self['realm']
  when 'Digest' then
    Mechanize::HTTP::AuthRealm.new scheme, uri + '/', self['realm']
  else
    raise Mechanize::Error, "unknown HTTP authentication scheme #{scheme}"
  end
end
realm_name() click to toggle source

The name of the realm for this challenge

# File lib/mechanize/http/auth_challenge.rb, line 53
def realm_name
  params['realm'] if Hash === params # NTLM has a string for params
end