auth_store.rb

Path: lib/mechanize/http/auth_store.rb
Last Update: Mon May 20 17:23:37 +0000 2013

A credential store for HTTP authentication.

  uri = URI 'http://example'

  store = Mechanize::HTTP::AuthStore.new
  store.add_auth uri, 'user1', 'pass'
  store.add_auth uri, 'user2', 'pass', 'realm'

  user, pass = store.credentials_for uri, 'realm' #=> 'user2', 'pass'
  user, pass = store.credentials_for uri, 'other' #=> 'user1', 'pass'

  store.remove_auth uri # removes all credentials

[Validate]