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
0
Merge Requests
0
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
Léo-Paul Géneau
gitlab-ce
Commits
1e2b6cf5
Commit
1e2b6cf5
authored
Jun 01, 2018
by
Lin Jen-Shin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Introduce Gitlab::Auth.omniauth_setup_providers
Which could extend from EE
parent
39b6f31c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
9 deletions
+18
-9
config/initializers/omniauth.rb
config/initializers/omniauth.rb
+1
-7
lib/gitlab/auth.rb
lib/gitlab/auth.rb
+17
-2
No files found.
config/initializers/omniauth.rb
View file @
1e2b6cf5
...
@@ -19,11 +19,5 @@ end
...
@@ -19,11 +19,5 @@ end
if
Gitlab
.
config
.
omniauth
.
enabled
if
Gitlab
.
config
.
omniauth
.
enabled
provider_names
=
Gitlab
.
config
.
omniauth
.
providers
.
map
(
&
:name
)
provider_names
=
Gitlab
.
config
.
omniauth
.
providers
.
map
(
&
:name
)
require
'omniauth-kerberos'
if
provider_names
.
include?
(
'kerberos'
)
Gitlab
::
Auth
.
omniauth_setup_providers
(
provider_names
)
Gitlab
::
Auth
.
omniauth_providers
.
each
do
|
provider
|
if
provider_names
.
include?
(
provider
)
require_dependency
"omni_auth/strategies/
#{
provider
}
"
end
end
end
end
lib/gitlab/auth.rb
View file @
1e2b6cf5
...
@@ -14,8 +14,23 @@ module Gitlab
...
@@ -14,8 +14,23 @@ module Gitlab
DEFAULT_SCOPES
=
[
:api
].
freeze
DEFAULT_SCOPES
=
[
:api
].
freeze
class
<<
self
class
<<
self
def
omniauth_providers
def
omniauth_customized_providers
%w[bitbucket jwt]
@omniauth_customized_providers
||=
%w[bitbucket jwt]
end
def
omniauth_setup_providers
(
provider_names
)
provider_names
.
each
do
|
provider
|
omniauth_setup_a_provider
(
provider
)
end
end
def
omniauth_setup_a_provider
(
provider
)
case
provider
when
'kerberos'
require
'omniauth-kerberos'
when
*
omniauth_customized_providers
require_dependency
"omni_auth/strategies/
#{
provider
}
"
end
end
end
def
find_for_git_client
(
login
,
password
,
project
:,
ip
:)
def
find_for_git_client
(
login
,
password
,
project
:,
ip
:)
...
...
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