class HttpDigestAuthenticationTest
Constants
- AUTH_HEADERS
Private Instance Methods
decode_credentials(header)
click to toggle source
# File actionpack/test/controller/http_digest_authentication_test.rb, line 279 def decode_credentials(header) ActionController::HttpAuthentication::Digest.decode_credentials(header) end
encode_credentials(options)
click to toggle source
# File actionpack/test/controller/http_digest_authentication_test.rb, line 254 def encode_credentials(options) options.reverse_merge!(nc: "00000001", cnonce: "0a4f113b", password_is_ha1: false) password = options.delete(:password) # Perform unauthenticated request to retrieve digest parameters to use on subsequent request method = options.delete(:method) || "GET" case method.to_s.upcase when "GET" get :index when "POST" post :index end assert_response :unauthorized credentials = decode_credentials(@response.headers["WWW-Authenticate"]) credentials.merge!(options) path_info = @request.env["PATH_INFO"].to_s uri = options[:uri] || path_info credentials.merge!(uri: uri) @request.env["ORIGINAL_FULLPATH"] = path_info ActionController::HttpAuthentication::Digest.encode_credentials(method, credentials, password, options[:password_is_ha1]) end