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
869246d0
Commit
869246d0
authored
Sep 03, 2020
by
Blair Lunceford
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Apply suggested changes
- Add additional test - Rename variable in auto_link_user? setting
parent
686b1dd9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
5 deletions
+17
-5
lib/gitlab/auth/o_auth/user.rb
lib/gitlab/auth/o_auth/user.rb
+4
-4
spec/lib/gitlab/auth/o_auth/user_spec.rb
spec/lib/gitlab/auth/o_auth/user_spec.rb
+13
-1
No files found.
lib/gitlab/auth/o_auth/user.rb
View file @
869246d0
...
...
@@ -273,11 +273,11 @@ module Gitlab
end
def
auto_link_user?
providers
=
Gitlab
.
config
.
omniauth
.
auto_link_user
if
providers
.
is_a?
(
Array
)
providers
.
include?
(
auth_hash
.
provider
)
auto_link
=
Gitlab
.
config
.
omniauth
.
auto_link_user
if
auto_link
.
is_a?
(
Array
)
auto_link
.
include?
(
auth_hash
.
provider
)
else
providers
auto_link
end
end
end
...
...
spec/lib/gitlab/auth/o_auth/user_spec.rb
View file @
869246d0
...
...
@@ -207,7 +207,19 @@ RSpec.describe Gitlab::Auth::OAuth::User do
stub_omniauth_config
(
auto_link_user:
[
'saml'
])
end
include_examples
"to verify compliance with allow_single_sign_on"
context
"and a current GitLab user with a matching email"
do
let!
(
:existing_user
)
{
create
(
:user
,
email:
'john@mail.com'
,
username:
'john'
)
}
it
"adds the OmniAuth identity to the GitLab user account"
do
oauth_user
.
save
expect
(
gl_user
).
not_to
be_valid
end
end
context
"and no current GitLab user with a matching email"
do
include_examples
"to verify compliance with allow_single_sign_on"
end
end
context
"with auto_link_user enabled for the correct provider"
do
...
...
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