Method: Mechanize::HTTP::AuthStore#credentials_for

Defined in:
lib/mechanize/http/auth_store.rb

#credentials_for(uri, realm) ⇒ Object

Retrieves credentials for realm on the server at uri.

[View source]

93
94
95
96
97
98
99
100
101
102
103
# File 'lib/mechanize/http/auth_store.rb', line 93

def credentials_for uri, realm
  uri = URI uri unless URI === uri

  uri += '/'
  uri.user = nil
  uri.password = nil

  realms = @auth_accounts[uri]

  realms[realm] || realms[nil] || @default_auth
end