/usr/lib/ruby/vendor_ruby/mechanize/http/auth_challenge.rb is in ruby-mechanize 2.7.2-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | class Mechanize::HTTP
AuthChallenge = Struct.new :scheme, :params, :raw
##
# A parsed WWW-Authenticate header
class AuthChallenge
##
# :attr_accessor: scheme
#
# The authentication scheme
##
# :attr_accessor: params
#
# The authentication parameters
##
# :method: initialize
#
# :call-seq:
# initialize(scheme = nil, params = nil)
#
# Creates a new AuthChallenge header with the given scheme and parameters
##
# Retrieves +param+ from the params list
def [] param
params[param]
end
##
# Constructs an AuthRealm for this challenge
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
##
# The name of the realm for this challenge
def realm_name
params['realm'] if Hash === params # NTLM has a string for params
end
##
# The raw authentication challenge
alias to_s raw
end
end
|