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
f85676cc
Unverified
Commit
f85676cc
authored
6 years ago
by
Richard van der Hoff
Committed by
GitHub
6 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Return well_known in /login response (#4319)
... as per MSC1730.
parent
3355c1a9
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
changelog.d/4319.feature
+1
-0
1 addition, 0 deletions
changelog.d/4319.feature
synapse/rest/client/v1/login.py
+11
-7
11 additions, 7 deletions
synapse/rest/client/v1/login.py
tests/utils.py
+3
-0
3 additions, 0 deletions
tests/utils.py
with
15 additions
and
7 deletions
changelog.d/4319.feature
0 → 100644
+
1
−
0
View file @
f85676cc
Return
server
dat
a
in /login response
\ No newline at end of file
This diff is collapsed.
Click to expand it.
synapse/rest/client/v1/login.py
+
11
−
7
View file @
f85676cc
...
...
@@ -28,6 +28,7 @@ from synapse.http.servlet import (
parse_json_object_from_request
,
parse_string
,
)
from
synapse.rest.well_known
import
WellKnownBuilder
from
synapse.types
import
UserID
,
map_username_to_mxid_localpart
from
synapse.util.msisdn
import
phone_number_to_msisdn
...
...
@@ -95,6 +96,7 @@ class LoginRestServlet(ClientV1RestServlet):
self
.
auth_handler
=
self
.
hs
.
get_auth_handler
()
self
.
device_handler
=
self
.
hs
.
get_device_handler
()
self
.
handlers
=
hs
.
get_handlers
()
self
.
_well_known_builder
=
WellKnownBuilder
(
hs
)
def
on_GET
(
self
,
request
):
flows
=
[]
...
...
@@ -132,16 +134,18 @@ class LoginRestServlet(ClientV1RestServlet):
if
self
.
jwt_enabled
and
(
login_submission
[
"
type
"
]
==
LoginRestServlet
.
JWT_TYPE
):
result
=
yield
self
.
do_jwt_login
(
login_submission
)
defer
.
returnValue
(
result
)
elif
login_submission
[
"
type
"
]
==
LoginRestServlet
.
TOKEN_TYPE
:
result
=
yield
self
.
do_token_login
(
login_submission
)
defer
.
returnValue
(
result
)
else
:
result
=
yield
self
.
_do_other_login
(
login_submission
)
defer
.
returnValue
(
result
)
except
KeyError
:
raise
SynapseError
(
400
,
"
Missing JSON keys.
"
)
well_known_data
=
self
.
_well_known_builder
.
get_well_known
()
if
well_known_data
:
result
[
"
well_known
"
]
=
well_known_data
defer
.
returnValue
((
200
,
result
))
@defer.inlineCallbacks
def
_do_other_login
(
self
,
login_submission
):
"""
Handle non-token/saml/jwt logins
...
...
@@ -150,7 +154,7 @@ class LoginRestServlet(ClientV1RestServlet):
login_submission:
Returns:
(int, obje
ct
)
: HTTP
code/
response
di
ct: HTTP response
"""
# Log the request we got, but only certain fields to minimise the chance of
# logging someone's password (even if they accidentally put it in the wrong
...
...
@@ -233,7 +237,7 @@ class LoginRestServlet(ClientV1RestServlet):
if
callback
is
not
None
:
yield
callback
(
result
)
defer
.
returnValue
(
(
200
,
result
)
)
defer
.
returnValue
(
result
)
@defer.inlineCallbacks
def
do_token_login
(
self
,
login_submission
):
...
...
@@ -253,7 +257,7 @@ class LoginRestServlet(ClientV1RestServlet):
"
device_id
"
:
device_id
,
}
defer
.
returnValue
(
(
200
,
result
)
)
defer
.
returnValue
(
result
)
@defer.inlineCallbacks
def
do_jwt_login
(
self
,
login_submission
):
...
...
@@ -307,7 +311,7 @@ class LoginRestServlet(ClientV1RestServlet):
"
home_server
"
:
self
.
hs
.
hostname
,
}
defer
.
returnValue
(
(
200
,
result
)
)
defer
.
returnValue
(
result
)
def
_register_device
(
self
,
user_id
,
login_submission
):
"""
Register a device for a user.
...
...
This diff is collapsed.
Click to expand it.
tests/utils.py
+
3
−
0
View file @
f85676cc
...
...
@@ -140,6 +140,9 @@ def default_config(name):
config
.
rc_messages_per_second
=
10000
config
.
rc_message_burst_count
=
10000
config
.
saml2_enabled
=
False
config
.
public_baseurl
=
None
config
.
default_identity_server
=
None
config
.
use_frozen_dicts
=
False
# we need a sane default_room_version, otherwise attempts to create rooms will
...
...
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