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
4fbce200
Commit
4fbce200
authored
Apr 22, 2021
by
Gosia Ksionek
Committed by
Matthias Käppler
Apr 22, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Provide fix for inconsistent blocking of sso-user git actions
parent
568571cf
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
1 deletion
+24
-1
ee/changelogs/unreleased/9152-check-sso-status-on-git-activity-and-direct-user-to-sso-fix.yml
...sso-status-on-git-activity-and-direct-user-to-sso-fix.yml
+5
-0
ee/lib/gitlab/auth/group_saml/session_enforcer.rb
ee/lib/gitlab/auth/group_saml/session_enforcer.rb
+1
-1
ee/spec/lib/gitlab/auth/group_saml/session_enforcer_spec.rb
ee/spec/lib/gitlab/auth/group_saml/session_enforcer_spec.rb
+18
-0
No files found.
ee/changelogs/unreleased/9152-check-sso-status-on-git-activity-and-direct-user-to-sso-fix.yml
0 → 100644
View file @
4fbce200
---
title
:
Provide fix for inconsistent blocking of sso-user git actions
merge_request
:
59872
author
:
type
:
fixed
ee/lib/gitlab/auth/group_saml/session_enforcer.rb
View file @
4fbce200
...
...
@@ -61,7 +61,7 @@ module Gitlab
sessions
=
ActiveSession
.
list_sessions
(
user
)
sessions
.
filter_map
do
|
session
|
Gitlab
::
NamespacedSessionStore
.
new
(
SESSION_STORE_KEY
,
session
.
with_indifferent_access
)[
saml_provider
.
id
]
end
.
last
end
.
max
end
end
end
...
...
ee/spec/lib/gitlab/auth/group_saml/session_enforcer_spec.rb
View file @
4fbce200
...
...
@@ -67,6 +67,24 @@ RSpec.describe Gitlab::Auth::GroupSaml::SessionEnforcer do
it
{
is_expected
.
to
be_falsey
}
end
context
'with two active sessions for the same provider and one pre-sso'
,
:clean_gitlab_redis_shared_state
do
let
(
:second_session_id
)
{
'52'
}
let
(
:third_session_id
)
{
'62'
}
let
(
:second_stored_session
)
do
{
'active_group_sso_sign_ins'
=>
{
saml_provider
.
id
=>
2
.
days
.
ago
}
}
end
before
do
Gitlab
::
Redis
::
SharedState
.
with
do
|
redis
|
redis
.
set
(
"session:gitlab:
#{
second_session_id
}
"
,
Marshal
.
dump
(
second_stored_session
))
redis
.
set
(
"session:gitlab:
#{
third_session_id
}
"
,
Marshal
.
dump
({}))
redis
.
sadd
(
"session:lookup:user:gitlab:
#{
user
.
id
}
"
,
[
session_id
,
second_session_id
,
third_session_id
])
end
end
it
{
is_expected
.
to
be_falsey
}
end
context
'without enforced_sso_expiry feature flag'
do
let
(
:session_time
)
{
2
.
days
.
ago
}
...
...
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