Class Mechanize::HTTP::AuthStore
In: lib/mechanize/http/auth_store.rb
Parent: Object

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

Methods

Public Class methods

Public Instance methods

Adds credentials user, pass for the server at uri. If realm is set the credentials are used only for that realm. If realm is not set the credentials become the default for any realm on that URI.

domain and realm are exclusive as NTLM does not follow RFC

  1. If domain is given it is only used for NTLM authentication.

USE OF add_default_auth IS NOT RECOMMENDED AS IT MAY EXPOSE PASSWORDS TO THIRD PARTIES

Adds credentials user, pass as the default authentication credentials. If no other credentials are available these will be returned from credentials_for.

If domain is given it is only used for NTLM authentication.

Returns true if credentials exist for the challenges from the server at uri.

Retrieves credentials for realm on the server at uri.

Removes credentials for realm on the server at uri. If realm is not set all credentials for the server at uri are removed.

[Validate]