Commit b4d1d7718e24612183a249726ca302b1eedb3675
1 parent
e4d2749c
Exists in
master
strip out email from uid; search by samAccountName
Showing
1 changed file
with
2 additions
and
2 deletions
Show diff stats
lib/omniauth/strategies/env.rb
| ... | ... | @@ -18,7 +18,7 @@ module OmniAuth |
| 18 | 18 | |
| 19 | 19 | def request_phase |
| 20 | 20 | @user_data = {} |
| 21 | - @uid = env_user | |
| 21 | + @uid = env_user.gsub(/@.*/, '') | |
| 22 | 22 | |
| 23 | 23 | return fail!(:no_user) unless @uid |
| 24 | 24 | |
| ... | ... | @@ -40,7 +40,7 @@ module OmniAuth |
| 40 | 40 | def fill_ldap_info |
| 41 | 41 | adaptor = OmniAuth::LDAP::Adaptor.new @options |
| 42 | 42 | |
| 43 | - filter = Net::LDAP::Filter.eq('cn', @uid) | |
| 43 | + filter = Net::LDAP::Filter.eq('samAccountName', @uid) | |
| 44 | 44 | adaptor.connection.search(base: @options[:base], filter: filter) do |entry| |
| 45 | 45 | @user_data[:name] = "#{entry.givenname.first} #{entry.sn.first}" |
| 46 | 46 | @user_data[:email] = entry.mail.first | ... | ... |