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
bb4fa3a1
Commit
bb4fa3a1
authored
Feb 18, 2016
by
Patricio Cano
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make new `allow_single_sign_on` feature backwards compatible
parent
06376be5
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
4 deletions
+28
-4
lib/gitlab/o_auth/user.rb
lib/gitlab/o_auth/user.rb
+5
-1
spec/lib/gitlab/o_auth/user_spec.rb
spec/lib/gitlab/o_auth/user_spec.rb
+22
-2
spec/lib/gitlab/saml/user_spec.rb
spec/lib/gitlab/saml/user_spec.rb
+1
-1
No files found.
lib/gitlab/o_auth/user.rb
View file @
bb4fa3a1
...
@@ -106,7 +106,11 @@ module Gitlab
...
@@ -106,7 +106,11 @@ module Gitlab
def
signup_enabled?
def
signup_enabled?
providers
=
Gitlab
.
config
.
omniauth
.
allow_single_sign_on
providers
=
Gitlab
.
config
.
omniauth
.
allow_single_sign_on
providers
.
include?
(
auth_hash
.
provider
)
if
providers
.
is_a?
(
Array
)
providers
.
include?
(
auth_hash
.
provider
)
else
providers
end
end
end
def
block_after_signup?
def
block_after_signup?
...
...
spec/lib/gitlab/o_auth/user_spec.rb
View file @
bb4fa3a1
...
@@ -41,7 +41,7 @@ describe Gitlab::OAuth::User, lib: true do
...
@@ -41,7 +41,7 @@ describe Gitlab::OAuth::User, lib: true do
describe
'signup'
do
describe
'signup'
do
shared_examples
"to verify compliance with allow_single_sign_on"
do
shared_examples
"to verify compliance with allow_single_sign_on"
do
context
"with
allow_single_sign_on enabled
"
do
context
"with
new allow_single_sign_on enabled syntax
"
do
before
{
stub_omniauth_config
(
allow_single_sign_on:
[
'twitter'
])
}
before
{
stub_omniauth_config
(
allow_single_sign_on:
[
'twitter'
])
}
it
"creates a user from Omniauth"
do
it
"creates a user from Omniauth"
do
...
@@ -54,12 +54,32 @@ describe Gitlab::OAuth::User, lib: true do
...
@@ -54,12 +54,32 @@ describe Gitlab::OAuth::User, lib: true do
end
end
end
end
context
"with allow_single_sign_on disabled (Default)"
do
context
"with old allow_single_sign_on enabled syntax"
do
before
{
stub_omniauth_config
(
allow_single_sign_on:
true
)
}
it
"creates a user from Omniauth"
do
oauth_user
.
save
expect
(
gl_user
).
to
be_valid
identity
=
gl_user
.
identities
.
first
expect
(
identity
.
extern_uid
).
to
eql
uid
expect
(
identity
.
provider
).
to
eql
'twitter'
end
end
context
"with new allow_single_sign_on disabled syntax"
do
before
{
stub_omniauth_config
(
allow_single_sign_on:
[])
}
before
{
stub_omniauth_config
(
allow_single_sign_on:
[])
}
it
"throws an error"
do
it
"throws an error"
do
expect
{
oauth_user
.
save
}.
to
raise_error
StandardError
expect
{
oauth_user
.
save
}.
to
raise_error
StandardError
end
end
end
end
context
"with old allow_single_sign_on disabled (Default)"
do
before
{
stub_omniauth_config
(
allow_single_sign_on:
false
)
}
it
"throws an error"
do
expect
{
oauth_user
.
save
}.
to
raise_error
StandardError
end
end
end
end
context
"with auto_link_ldap_user disabled (default)"
do
context
"with auto_link_ldap_user disabled (default)"
do
...
...
spec/lib/gitlab/saml/user_spec.rb
View file @
bb4fa3a1
...
@@ -61,7 +61,7 @@ describe Gitlab::Saml::User, lib: true do
...
@@ -61,7 +61,7 @@ describe Gitlab::Saml::User, lib: true do
end
end
context
'with allow_single_sign_on disabled'
do
context
'with allow_single_sign_on disabled'
do
before
{
stub_omniauth_config
(
allow_single_sign_on:
[]
)
}
before
{
stub_omniauth_config
(
allow_single_sign_on:
false
)
}
it
'should throw an error'
do
it
'should throw an error'
do
expect
{
saml_user
.
save
}.
to
raise_error
StandardError
expect
{
saml_user
.
save
}.
to
raise_error
StandardError
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