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
4 5 6 |
# File 'lib/mechanize/http/auth_challenge.rb', line 4 def params @params end |
#raw ⇒ Object Also known as: to_s
Returns the value of attribute raw
4 5 6 |
# File 'lib/mechanize/http/auth_challenge.rb', line 4 def raw @raw end |
#scheme ⇒ Object
Returns the value of attribute scheme
4 5 6 |
# File 'lib/mechanize/http/auth_challenge.rb', line 4 def scheme @scheme end |
Instance Method Details
#[](param) ⇒ Object
Retrieves param
from the params list
32 33 34 |
# File 'lib/mechanize/http/auth_challenge.rb', line 32 def [] param params[param] end |
#realm(uri) ⇒ Object
Constructs an AuthRealm for this challenge
39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/mechanize/http/auth_challenge.rb', line 39 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
54 55 56 |
# File 'lib/mechanize/http/auth_challenge.rb', line 54 def realm_name params['realm'] if Hash === params # NTLM has a string for params end |