class HttpBasicAuthenticationTest::DummyController

Public Instance Methods

display() click to toggle source
# File actionpack/test/controller/http_basic_authentication_test.rb, line 18
def display
  render plain: "Definitely Maybe" if @logged_in
end
index() click to toggle source
# File actionpack/test/controller/http_basic_authentication_test.rb, line 14
def index
  render plain: "Hello Secret"
end
show() click to toggle source
# File actionpack/test/controller/http_basic_authentication_test.rb, line 22
def show
  render plain: "Only for loooooong credentials"
end
special_creds() click to toggle source
# File actionpack/test/controller/http_basic_authentication_test.rb, line 26
def special_creds
  render plain: "Only for special credentials"
end

Private Instance Methods

auth_with_special_chars() click to toggle source
# File actionpack/test/controller/http_basic_authentication_test.rb, line 50
def auth_with_special_chars
  authenticate_or_request_with_http_basic do |username, password|
    username == 'login!@#$%^&*()_+{}[];"\',./<>?`~ \n\r\t' && password == 'pwd:!@#$%^&*()_+{}[];"\',./<>?`~ \n\r\t'
  end
end
authenticate() click to toggle source
# File actionpack/test/controller/http_basic_authentication_test.rb, line 36
def authenticate
  authenticate_or_request_with_http_basic do |username, password|
    username == "lifo" && password == "world"
  end
end
authenticate_long_credentials() click to toggle source
# File actionpack/test/controller/http_basic_authentication_test.rb, line 56
def authenticate_long_credentials
  authenticate_or_request_with_http_basic do |username, password|
    username == "1234567890123456789012345678901234567890" && password == "1234567890123456789012345678901234567890"
  end
end
authenticate_with_request() click to toggle source
# File actionpack/test/controller/http_basic_authentication_test.rb, line 42
def authenticate_with_request
  if authenticate_with_http_basic { |username, password| username == "pretty" && password == "please" }
    @logged_in = true
  else
    request_http_basic_authentication("SuperSecret", "Authentication Failed\n")
  end
end