Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
synapse
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Monitor
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Maunium
synapse
Commits
26d10331
"README.md" did not exist on "fa583c2198c75583ed5e16e9ecd157a9d10f6417"
Commit
26d10331
authored
4 years ago
by
Richard van der Hoff
Browse files
Options
Downloads
Patches
Plain Diff
Add a test for wrong user returned by SSO
parent
42003190
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/rest/client/v2_alpha/test_auth.py
+27
-0
27 additions, 0 deletions
tests/rest/client/v2_alpha/test_auth.py
with
27 additions
and
0 deletions
tests/rest/client/v2_alpha/test_auth.py
+
27
−
0
View file @
26d10331
...
@@ -457,3 +457,30 @@ class UIAuthTests(unittest.HomeserverTestCase):
...
@@ -457,3 +457,30 @@ class UIAuthTests(unittest.HomeserverTestCase):
self
.
assertIn
({
"
stages
"
:
[
"
m.login.password
"
]},
flows
)
self
.
assertIn
({
"
stages
"
:
[
"
m.login.password
"
]},
flows
)
self
.
assertIn
({
"
stages
"
:
[
"
m.login.sso
"
]},
flows
)
self
.
assertIn
({
"
stages
"
:
[
"
m.login.sso
"
]},
flows
)
self
.
assertEqual
(
len
(
flows
),
2
)
self
.
assertEqual
(
len
(
flows
),
2
)
@skip_unless
(
HAS_OIDC
,
"
requires OIDC
"
)
@override_config
({
"
oidc_config
"
:
TEST_OIDC_CONFIG
})
def
test_ui_auth_fails_for_incorrect_sso_user
(
self
):
"""
If the user tries to authenticate with the wrong SSO user, they get an error
"""
# log the user in
login_resp
=
self
.
helper
.
login_via_oidc
(
UserID
.
from_string
(
self
.
user
).
localpart
)
self
.
assertEqual
(
login_resp
[
"
user_id
"
],
self
.
user
)
# start a UI Auth flow by attempting to delete a device
channel
=
self
.
delete_device
(
self
.
user_tok
,
self
.
device_id
,
401
)
flows
=
channel
.
json_body
[
"
flows
"
]
self
.
assertIn
({
"
stages
"
:
[
"
m.login.sso
"
]},
flows
)
session_id
=
channel
.
json_body
[
"
session
"
]
# do the OIDC auth, but auth as the wrong user
channel
=
self
.
helper
.
auth_via_oidc
(
"
wrong_user
"
,
ui_auth_session_id
=
session_id
)
# that should return a failure message
self
.
assertSubstring
(
"
We were unable to validate
"
,
channel
.
text_body
)
# ... and the delete op should now fail with a 403
self
.
delete_device
(
self
.
user_tok
,
self
.
device_id
,
403
,
body
=
{
"
auth
"
:
{
"
session
"
:
session_id
}}
)
This diff is collapsed.
Click to expand it.
Tulir Asokan
@tulir
mentioned in commit
b5dea870
·
4 years ago
mentioned in commit
b5dea870
mentioned in commit b5dea8702d9b799a15d5b8fb90e82497b8c17f63
Toggle commit list
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment