Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
4f909803
Commit
4f909803
authored
Sep 14, 2013
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove code that was accidently added in
5dae40f5
parent
6df16564
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
66 deletions
+0
-66
lib/gitlab/auth.rb
lib/gitlab/auth.rb
+0
-66
No files found.
lib/gitlab/auth.rb
View file @
4f909803
...
...
@@ -13,72 +13,6 @@ module Gitlab
end
end
def
find_for_ldap_auth
(
auth
,
signed_in_resource
=
nil
)
uid
=
auth
.
info
.
uid
provider
=
auth
.
provider
email
=
auth
.
info
.
email
.
downcase
unless
auth
.
info
.
email
.
nil?
raise
OmniAuth
::
Error
,
"LDAP accounts must provide an uid and email address"
if
uid
.
nil?
or
email
.
nil?
if
@user
=
User
.
find_by_extern_uid_and_provider
(
uid
,
provider
)
@user
elsif
@user
=
User
.
find_by_email
(
email
)
log
.
info
"Updating legacy LDAP user
#{
email
}
with extern_uid =>
#{
uid
}
"
@user
.
update_attributes
(
extern_uid:
uid
,
provider:
provider
)
@user
else
create_from_omniauth
(
auth
,
true
)
end
end
def
create_from_omniauth
(
auth
,
ldap
=
false
)
provider
=
auth
.
provider
uid
=
auth
.
info
.
uid
||
auth
.
uid
uid
=
uid
.
to_s
.
force_encoding
(
"utf-8"
)
name
=
auth
.
info
.
name
.
to_s
.
force_encoding
(
"utf-8"
)
email
=
auth
.
info
.
email
.
to_s
.
downcase
unless
auth
.
info
.
email
.
nil?
ldap_prefix
=
ldap
?
'(LDAP) '
:
''
raise
OmniAuth
::
Error
,
"
#{
ldap_prefix
}#{
provider
}
does not provide an email"
\
" address"
if
auth
.
info
.
email
.
blank?
log
.
info
"
#{
ldap_prefix
}
Creating user from
#{
provider
}
login"
\
" {uid =>
#{
uid
}
, name =>
#{
name
}
, email =>
#{
email
}
}"
password
=
Devise
.
friendly_token
[
0
,
8
].
downcase
@user
=
User
.
build_user
({
extern_uid:
uid
,
provider:
provider
,
name:
name
,
username:
email
.
match
(
/^[^@]*/
)[
0
],
email:
email
,
password:
password
,
password_confirmation:
password
,
},
as: :admin
)
@user
.
save!
if
Gitlab
.
config
.
omniauth
[
'block_auto_created_users'
]
&&
!
ldap
@user
.
block
end
@user
end
def
find_or_new_for_omniauth
(
auth
)
provider
,
uid
=
auth
.
provider
,
auth
.
uid
email
=
auth
.
info
.
email
.
downcase
unless
auth
.
info
.
email
.
nil?
if
@user
=
User
.
find_by_provider_and_extern_uid
(
provider
,
uid
)
@user
elsif
@user
=
User
.
find_by_email
(
email
)
@user
.
update_attributes
(
extern_uid:
uid
,
provider:
provider
)
@user
else
if
Gitlab
.
config
.
omniauth
[
'allow_single_sign_on'
]
@user
=
create_from_omniauth
(
auth
)
@user
end
end
end
def
log
Gitlab
::
AppLogger
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment