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
83b464e4
Commit
83b464e4
authored
9 years ago
by
Steven Hammerton
Browse files
Options
Downloads
Patches
Plain Diff
Unpack dictionary in for loop for nicer syntax
parent
ab7f9bb8
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
synapse/rest/client/v1/login.py
+4
-4
4 additions, 4 deletions
synapse/rest/client/v1/login.py
with
4 additions
and
4 deletions
synapse/rest/client/v1/login.py
+
4
−
4
View file @
83b464e4
...
...
@@ -127,16 +127,16 @@ class LoginRestServlet(ClientV1RestServlet):
def
do_cas_login
(
self
,
cas_response_body
):
user
,
attributes
=
self
.
parse_cas_response
(
cas_response_body
)
for
required_attribute
in
self
.
cas_required_attributes
:
for
required_attribute
,
required_value
in
self
.
cas_required_attributes
.
items
()
:
# If required attribute was not in CAS Response - Forbidden
if
required_attribute
not
in
attributes
:
raise
LoginError
(
401
,
"
Unauthorized
"
,
errcode
=
Codes
.
UNAUTHORIZED
)
# Also need to check value
if
self
.
cas_required_attributes
[
required_attribute
]
is
not
None
:
actual
V
alue
=
attributes
[
required_attribute
]
if
required_value
is
not
None
:
actual
_v
alue
=
attributes
[
required_attribute
]
# If required attribute value does not match expected - Forbidden
if
self
.
cas_required_attributes
[
required_attribute
]
!=
actual
V
alue
:
if
required_value
!=
actual
_v
alue
:
raise
LoginError
(
401
,
"
Unauthorized
"
,
errcode
=
Codes
.
UNAUTHORIZED
)
user_id
=
UserID
.
create
(
user
,
self
.
hs
.
hostname
).
to_string
()
...
...
This diff is collapsed.
Click to expand it.
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