Commit e4d2749ccd33344dbc488a3d13aee82bdce713aa
1 parent
a4e1062f
Exists in
master
also allow X-Fowarded-User header
Showing
1 changed file
with
10 additions
and
1 deletions
Show diff stats
lib/omniauth/strategies/env.rb
@@ -8,9 +8,18 @@ module OmniAuth | @@ -8,9 +8,18 @@ module OmniAuth | ||
8 | class Env | 8 | class Env |
9 | include OmniAuth::Strategy | 9 | include OmniAuth::Strategy |
10 | 10 | ||
11 | + def env_user | ||
12 | + if env['HTTP_REMOTE_USER'] && env['HTTP_REMOTE_USER'] != '' | ||
13 | + env['HTTP_REMOTE_USER'] | ||
14 | + else | ||
15 | + env['HTTP_X_FORWARDED_USER'] | ||
16 | + end | ||
17 | + end | ||
18 | + | ||
11 | def request_phase | 19 | def request_phase |
12 | @user_data = {} | 20 | @user_data = {} |
13 | - @uid = env['HTTP_REMOTE_USER'] | 21 | + @uid = env_user |
22 | + | ||
14 | return fail!(:no_user) unless @uid | 23 | return fail!(:no_user) unless @uid |
15 | 24 | ||
16 | fill_ldap_info unless @options.empty? | 25 | fill_ldap_info unless @options.empty? |