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
1065f0bf
Commit
1065f0bf
authored
May 28, 2019
by
James Edwards-Jones
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SAML Session Enforcement works with 2FA
parent
7a4006f8
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
6 deletions
+30
-6
ee/app/controllers/groups/omniauth_callbacks_controller.rb
ee/app/controllers/groups/omniauth_callbacks_controller.rb
+7
-0
ee/changelogs/unreleased/jej-fix-sso-enforcement-with-2fa.yml
...hangelogs/unreleased/jej-fix-sso-enforcement-with-2fa.yml
+5
-0
ee/spec/controllers/groups/omniauth_callbacks_controller_spec.rb
.../controllers/groups/omniauth_callbacks_controller_spec.rb
+18
-6
No files found.
ee/app/controllers/groups/omniauth_callbacks_controller.rb
View file @
1065f0bf
...
...
@@ -62,6 +62,13 @@ class Groups::OmniauthCallbacksController < OmniauthCallbacksController
super
end
override
:prompt_for_two_factor
def
prompt_for_two_factor
(
user
)
store_active_saml_session
super
end
def
store_active_saml_session
Gitlab
::
Auth
::
GroupSaml
::
SsoEnforcer
.
new
(
@saml_provider
).
update_session
end
...
...
ee/changelogs/unreleased/jej-fix-sso-enforcement-with-2fa.yml
0 → 100644
View file @
1065f0bf
---
title
:
Fix SSO Enforcement when used with 2FA
merge_request
:
13473
author
:
type
:
fixed
ee/spec/controllers/groups/omniauth_callbacks_controller_spec.rb
View file @
1065f0bf
...
...
@@ -50,6 +50,15 @@ describe Groups::OmniauthCallbacksController do
Rails
.
application
.
env_config
[
'omniauth.auth'
]
=
@original_env_config_omniauth_auth
end
shared_examples
'works with session enforcement'
do
it
'stores that a SAML session is active'
do
expect
(
Gitlab
::
Auth
::
GroupSaml
::
SsoEnforcer
).
to
receive
(
:new
).
with
(
saml_provider
).
and_call_original
expect_any_instance_of
(
Gitlab
::
Auth
::
GroupSaml
::
SsoEnforcer
).
to
receive
(
:update_session
)
post
provider
,
params:
{
group_id:
group
}
end
end
shared_examples
"SAML session initiated"
do
it
"redirects to RelayState"
do
post
provider
,
params:
{
group_id:
group
,
RelayState
:
'/explore'
}
...
...
@@ -57,12 +66,7 @@ describe Groups::OmniauthCallbacksController do
expect
(
response
).
to
redirect_to
(
'/explore'
)
end
it
'stores that a SAML session is active'
do
expect
(
Gitlab
::
Auth
::
GroupSaml
::
SsoEnforcer
).
to
receive
(
:new
).
with
(
saml_provider
).
and_call_original
expect_any_instance_of
(
Gitlab
::
Auth
::
GroupSaml
::
SsoEnforcer
).
to
receive
(
:update_session
)
post
provider
,
params:
{
group_id:
group
}
end
include_examples
'works with session enforcement'
end
shared_examples
"and identity already linked"
do
...
...
@@ -88,6 +92,14 @@ describe Groups::OmniauthCallbacksController do
expect
(
response
).
not_to
be_server_error
end
end
context
'with 2FA'
do
before
do
user
.
update!
(
otp_required_for_login:
true
)
end
include_examples
'works with session enforcement'
end
end
context
"when signed in"
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