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
60b480fe
Commit
60b480fe
authored
Mar 21, 2018
by
James Edwards-Jones
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
OmniauthInitializer refactoring
parent
97cf5d73
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
33 deletions
+31
-33
lib/gitlab/omniauth_initializer.rb
lib/gitlab/omniauth_initializer.rb
+31
-33
No files found.
lib/gitlab/omniauth_initializer.rb
View file @
60b480fe
...
@@ -4,51 +4,49 @@ module Gitlab
...
@@ -4,51 +4,49 @@ module Gitlab
@devise_config
=
devise_config
@devise_config
=
devise_config
end
end
def
config
@devise_config
end
def
execute
(
providers
)
def
execute
(
providers
)
initialize_providers
(
providers
)
providers
.
each
do
|
provider
|
add_provider
(
provider
[
'name'
].
to_sym
,
*
arguments_for
(
provider
))
end
end
end
private
private
def
initialize_providers
(
providers
)
def
add_provider
(
*
args
)
providers
.
each
do
|
provider
|
@devise_config
.
omniauth
(
*
args
)
provider_arguments
=
[]
end
%w[app_id app_secret]
.
each
do
|
argument
|
provider_arguments
<<
provider
[
argument
]
if
provider
[
argument
]
end
case
provider
[
'args'
]
when
Array
# An Array from the configuration will be expanded.
provider_arguments
.
concat
provider
[
'args'
]
when
Hash
set_provider_specific_defaults
(
provider
)
# A Hash from the configuration will be passed as is.
def
arguments_for
(
provider
)
provider_arguments
<<
provider
[
'args'
].
symbolize_keys
provider_arguments
=
[]
end
config
.
omniauth
provider
[
'name'
].
to_sym
,
*
provider_arguments
%w[app_id app_secret]
.
each
do
|
argument
|
provider_arguments
<<
provider
[
argument
]
if
provider
[
argument
]
end
end
end
def
set_provider_specific_defaults
(
provider
)
case
provider
[
'args'
]
# Add procs for handling SLO
when
Array
if
provider
[
'name'
]
==
'cas3'
# An Array from the configuration will be expanded.
provider
[
'args'
][
:on_single_sign_out
]
=
cas3_signout_handler
provider_arguments
.
concat
provider
[
'args'
]
end
when
Hash
hash_arguments
=
provider
[
'args'
].
merge
(
provider_defaults
(
provider
))
if
provider
[
'name'
]
==
'authentiq'
# A Hash from the configuration will be passed as is.
provider
[
'args'
][
:remote_sign_out_handler
]
=
authentiq_signout_handler
provider
_arguments
<<
hash_arguments
.
symbolize_keys
end
end
if
provider
[
'name'
]
==
'shibboleth'
provider_arguments
provider
[
'args'
][
:fail_with_empty_uid
]
=
true
end
def
provider_defaults
(
provider
)
case
provider
[
'name'
]
when
'cas3'
{
on_single_sign_out:
cas3_signout_handler
}
when
'authentiq'
{
remote_sign_out_handler:
authentiq_signout_handler
}
when
'shibboleth'
{
fail_with_empty_uid:
true
}
else
{}
end
end
end
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