Class: Mechanize::HTTP::AuthChallenge
- Inherits:
-
Struct
- Object
- Struct
- Mechanize::HTTP::AuthChallenge
- Defined in:
- lib/mechanize/http/auth_challenge.rb,
lib/mechanize/http/auth_challenge.rb
Overview
A parsed WWW-Authenticate header
Instance Attribute Summary collapse
-
#params ⇒ Object
Returns the value of attribute params.
-
#raw ⇒ Object
(also: #to_s)
Returns the value of attribute raw.
-
#scheme ⇒ Object
Returns the value of attribute scheme.
Instance Method Summary collapse
-
#[](param) ⇒ Object
Retrieves
param
from the params list. -
#realm(uri) ⇒ Object
Constructs an AuthRealm for this challenge.
-
#realm_name ⇒ Object
The name of the realm for this challenge.
Instance Attribute Details
#params ⇒ Object
Returns the value of attribute params
3 4 5 |
# File 'lib/mechanize/http/auth_challenge.rb', line 3 def params @params end |
#raw ⇒ Object Also known as: to_s
Returns the value of attribute raw
3 4 5 |
# File 'lib/mechanize/http/auth_challenge.rb', line 3 def raw @raw end |
#scheme ⇒ Object
Returns the value of attribute scheme
3 4 5 |
# File 'lib/mechanize/http/auth_challenge.rb', line 3 def scheme @scheme end |
Instance Method Details
#[](param) ⇒ Object
Retrieves param
from the params list
31 32 33 |
# File 'lib/mechanize/http/auth_challenge.rb', line 31 def [] param params[param] end |
#realm(uri) ⇒ Object
Constructs an AuthRealm for this challenge
38 39 40 41 42 43 44 45 46 47 48 |
# 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 ⇒ Object
The name of the realm for this challenge
53 54 55 |
# File 'lib/mechanize/http/auth_challenge.rb', line 53 def realm_name params['realm'] if Hash === params # NTLM has a string for params end |