Project

General

Profile

Feature #1300 » 0001-fixes-1300-Add-support-of-HTTP-Auth-with-REMOTE_USER.patch

Romain Vrignaud, 12/19/2011 08:44 AM

View differences:

app/controllers/application_controller.rb
logger.warn("Failed authentcation from #{request.remote_ip} #{user}") if User.current.nil?
return !User.current.nil?
end
# if login delegation authorized and REMOTE_USER not empty, authenticate user without using password
if Setting["authorize_login_delegation"] == true and !request.env["REMOTE_USER"].nil?
user = User.find_by_login(request.env["REMOTE_USER"])
User.current = user.is_a?(User) ? user : nil
if !user.nil?
session[:user] = User.current.id
return !User.current.nil?
else
logger.warn("Failed authentcation from REMOTE_USER") if User.current.nil?
end
end
session[:original_uri] = request.request_uri # keep the old request uri that we can redirect later on
redirect_to login_users_path and return
else
lib/foreman/default_settings/loader.rb
set('foreman_url', "The hostname where your foreman instance is running on", "foreman.#{domain}"),
set('email_replay_address', "The email replay address for emails that foreman is sending", "Foreman-noreply@#{domain}"),
set('entries_per_page', "The amount of records shown per page in foreman", 20),
set('authorize_login_delegation',"Authorize login delegation with REMOTE_USER environment variable",false),
].each { |s| create s.update(:category => "General")}
[
(4-4/4)