Commit 4f9098032c0f55672f125b8be56d881490176959
1 parent
6df16564
Exists in
master
and in
4 other branches
Remove code that was accidently added in 5dae40f579f66fdc060de633b183ede7bd8b2ce4
Showing
1 changed file
with
0 additions
and
66 deletions
Show diff stats
lib/gitlab/auth.rb
... | ... | @@ -13,72 +13,6 @@ module Gitlab |
13 | 13 | end |
14 | 14 | end |
15 | 15 | |
16 | - def find_for_ldap_auth(auth, signed_in_resource = nil) | |
17 | - uid = auth.info.uid | |
18 | - provider = auth.provider | |
19 | - email = auth.info.email.downcase unless auth.info.email.nil? | |
20 | - raise OmniAuth::Error, "LDAP accounts must provide an uid and email address" if uid.nil? or email.nil? | |
21 | - | |
22 | - if @user = User.find_by_extern_uid_and_provider(uid, provider) | |
23 | - @user | |
24 | - elsif @user = User.find_by_email(email) | |
25 | - log.info "Updating legacy LDAP user #{email} with extern_uid => #{uid}" | |
26 | - @user.update_attributes(extern_uid: uid, provider: provider) | |
27 | - @user | |
28 | - else | |
29 | - create_from_omniauth(auth, true) | |
30 | - end | |
31 | - end | |
32 | - | |
33 | - def create_from_omniauth(auth, ldap = false) | |
34 | - provider = auth.provider | |
35 | - uid = auth.info.uid || auth.uid | |
36 | - uid = uid.to_s.force_encoding("utf-8") | |
37 | - name = auth.info.name.to_s.force_encoding("utf-8") | |
38 | - email = auth.info.email.to_s.downcase unless auth.info.email.nil? | |
39 | - | |
40 | - ldap_prefix = ldap ? '(LDAP) ' : '' | |
41 | - raise OmniAuth::Error, "#{ldap_prefix}#{provider} does not provide an email"\ | |
42 | - " address" if auth.info.email.blank? | |
43 | - | |
44 | - log.info "#{ldap_prefix}Creating user from #{provider} login"\ | |
45 | - " {uid => #{uid}, name => #{name}, email => #{email}}" | |
46 | - password = Devise.friendly_token[0, 8].downcase | |
47 | - @user = User.build_user({ | |
48 | - extern_uid: uid, | |
49 | - provider: provider, | |
50 | - name: name, | |
51 | - username: email.match(/^[^@]*/)[0], | |
52 | - email: email, | |
53 | - password: password, | |
54 | - password_confirmation: password, | |
55 | - }, as: :admin) | |
56 | - @user.save! | |
57 | - | |
58 | - if Gitlab.config.omniauth['block_auto_created_users'] && !ldap | |
59 | - @user.block | |
60 | - end | |
61 | - | |
62 | - @user | |
63 | - end | |
64 | - | |
65 | - def find_or_new_for_omniauth(auth) | |
66 | - provider, uid = auth.provider, auth.uid | |
67 | - email = auth.info.email.downcase unless auth.info.email.nil? | |
68 | - | |
69 | - if @user = User.find_by_provider_and_extern_uid(provider, uid) | |
70 | - @user | |
71 | - elsif @user = User.find_by_email(email) | |
72 | - @user.update_attributes(extern_uid: uid, provider: provider) | |
73 | - @user | |
74 | - else | |
75 | - if Gitlab.config.omniauth['allow_single_sign_on'] | |
76 | - @user = create_from_omniauth(auth) | |
77 | - @user | |
78 | - end | |
79 | - end | |
80 | - end | |
81 | - | |
82 | 16 | def log |
83 | 17 | Gitlab::AppLogger |
84 | 18 | end | ... | ... |