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
f1c429c7
Commit
f1c429c7
authored
May 23, 2019
by
GitLab Bot
Browse files
Options
Browse Files
Download
Plain Diff
Automatic merge of gitlab-org/gitlab-ce master
parents
d5dd60ee
7b5cc7b4
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
41 additions
and
1 deletion
+41
-1
changelogs/unreleased/sh-fix-omniauth-generic-strategy.yml
changelogs/unreleased/sh-fix-omniauth-generic-strategy.yml
+5
-0
lib/gitlab/omniauth_initializer.rb
lib/gitlab/omniauth_initializer.rb
+14
-1
spec/lib/gitlab/omniauth_initializer_spec.rb
spec/lib/gitlab/omniauth_initializer_spec.rb
+22
-0
No files found.
changelogs/unreleased/sh-fix-omniauth-generic-strategy.yml
0 → 100644
View file @
f1c429c7
---
title
:
Fix OmniAuth OAuth2Generic strategy not loading
merge_request
:
28680
author
:
type
:
fixed
lib/gitlab/omniauth_initializer.rb
View file @
f1c429c7
...
@@ -38,12 +38,25 @@ module Gitlab
...
@@ -38,12 +38,25 @@ module Gitlab
hash_arguments
=
provider
[
'args'
].
merge
(
provider_defaults
(
provider
))
hash_arguments
=
provider
[
'args'
].
merge
(
provider_defaults
(
provider
))
# A Hash from the configuration will be passed as is.
# A Hash from the configuration will be passed as is.
provider_arguments
<<
hash_arguments
.
symbolize_keys
provider_arguments
<<
normalize_hash_arguments
(
hash_arguments
)
end
end
provider_arguments
provider_arguments
end
end
def
normalize_hash_arguments
(
args
)
args
.
symbolize_keys!
# Rails 5.1 deprecated the use of string names in the middleware
# (https://github.com/rails/rails/commit/83b767ce), so we need to
# pass in the actual class to Devise.
if
args
[
:strategy_class
].
is_a?
(
String
)
args
[
:strategy_class
]
=
args
[
:strategy_class
].
constantize
end
args
end
def
provider_defaults
(
provider
)
def
provider_defaults
(
provider
)
case
provider
[
'name'
]
case
provider
[
'name'
]
when
'cas3'
when
'cas3'
...
...
spec/lib/gitlab/omniauth_initializer_spec.rb
View file @
f1c429c7
...
@@ -38,6 +38,28 @@ describe Gitlab::OmniauthInitializer do
...
@@ -38,6 +38,28 @@ describe Gitlab::OmniauthInitializer do
subject
.
execute
([
hash_config
])
subject
.
execute
([
hash_config
])
end
end
it
'normalizes a String strategy_class'
do
hash_config
=
{
'name'
=>
'hash'
,
'args'
=>
{
strategy_class:
'OmniAuth::Strategies::OAuth2Generic'
}
}
expect
(
devise_config
).
to
receive
(
:omniauth
).
with
(
:hash
,
strategy_class:
OmniAuth
::
Strategies
::
OAuth2Generic
)
subject
.
execute
([
hash_config
])
end
it
'allows a class to be specified in strategy_class'
do
hash_config
=
{
'name'
=>
'hash'
,
'args'
=>
{
strategy_class:
OmniAuth
::
Strategies
::
OAuth2Generic
}
}
expect
(
devise_config
).
to
receive
(
:omniauth
).
with
(
:hash
,
strategy_class:
OmniAuth
::
Strategies
::
OAuth2Generic
)
subject
.
execute
([
hash_config
])
end
it
'throws an error for an invalid strategy_class'
do
hash_config
=
{
'name'
=>
'hash'
,
'args'
=>
{
strategy_class:
'OmniAuth::Strategies::Bogus'
}
}
expect
{
subject
.
execute
([
hash_config
])
}.
to
raise_error
(
NameError
)
end
it
'configures fail_with_empty_uid for shibboleth'
do
it
'configures fail_with_empty_uid for shibboleth'
do
shibboleth_config
=
{
'name'
=>
'shibboleth'
,
'args'
=>
{}
}
shibboleth_config
=
{
'name'
=>
'shibboleth'
,
'args'
=>
{}
}
...
...
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