0001-fixes-1300-Add-support-of-HTTP-Auth-with-REMOTE_USER.patch
app/controllers/application_controller.rb | ||
---|---|---|
63 | 63 |
logger.warn("Failed authentcation from #{request.remote_ip} #{user}") if User.current.nil? |
64 | 64 |
return !User.current.nil? |
65 | 65 |
end |
66 |
# if login delegation authorized and REMOTE_USER not empty, authenticate user without using password |
|
67 |
if Setting["authorize_login_delegation"] == true and !request.env["REMOTE_USER"].nil? |
|
68 |
user = User.find_by_login(request.env["REMOTE_USER"]) |
|
69 |
User.current = user.is_a?(User) ? user : nil |
|
70 |
if !user.nil? |
|
71 |
session[:user] = User.current.id |
|
72 |
return !User.current.nil? |
|
73 |
else |
|
74 |
logger.warn("Failed authentcation from REMOTE_USER") if User.current.nil? |
|
75 |
end |
|
76 |
end |
|
66 | 77 |
session[:original_uri] = request.request_uri # keep the old request uri that we can redirect later on |
67 | 78 |
redirect_to login_users_path and return |
68 | 79 |
else |
lib/foreman/default_settings/loader.rb | ||
---|---|---|
28 | 28 |
set('foreman_url', "The hostname where your foreman instance is running on", "foreman.#{domain}"), |
29 | 29 |
set('email_replay_address', "The email replay address for emails that foreman is sending", "Foreman-noreply@#{domain}"), |
30 | 30 |
set('entries_per_page', "The amount of records shown per page in foreman", 20), |
31 |
set('authorize_login_delegation',"Authorize login delegation with REMOTE_USER environment variable",false), |
|
31 | 32 |
].each { |s| create s.update(:category => "General")} |
32 | 33 | |
33 | 34 |
[ |
34 |
- |