Skip to content

Instantly share code, notes, and snippets.

@r00k
Created August 14, 2009 20:41
Show Gist options
  • Save r00k/168094 to your computer and use it in GitHub Desktop.
Save r00k/168094 to your computer and use it in GitHub Desktop.
def authenticate
return true if Rails.env.test?
success = authenticate_or_request_with_http_digest do |user|
ADMIN_CREDENTIALS[user]
end
# We have to explicitly check if success is true here because
# auth_or_req_w_http_digest returns a string on authorization
# failure (?!)
session[:admin] ||= success
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment