Skip to content
This repository was archived by the owner on Apr 26, 2024. It is now read-only.

Commit ba3fd54

Browse files
authored
Remove unstable/unspecced login types. (#12597)
* `m.login.jwt`, which was never specced and has been deprecated since Synapse 1.16.0. (`org.matrix.login.jwt` can be used instead.) * `uk.half-shot.msc2778.login.application_service`, which was stabilized as part of the Matrix spec v1.2 release.
1 parent b2df071 commit ba3fd54

File tree

6 files changed

+14
-20
lines changed

6 files changed

+14
-20
lines changed

CHANGES.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
Synapse 1.59.0
2+
==============
3+
4+
The non-standard `m.login.jwt` login type has been removed from Synapse. It can be replaced with `org.matrix.login.jwt` for identical behaviour. This is only used if `jwt_config.enabled` is set to `true` in the configuration.
5+
6+
17
Synapse 1.58.0 (2022-05-03)
28
===========================
39

changelog.d/12597.removal

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Remove the unspecified `m.login.jwt` login type and the unstable `uk.half-shot.msc2778.login.application_service` from
2+
[MSC2778](https://github.com/matrix-org/matrix-doc/pull/2778).

docs/jwt.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,6 @@ follows:
1717
}
1818
```
1919

20-
Note that the login type of `m.login.jwt` is supported, but is deprecated. This
21-
will be removed in a future version of Synapse.
22-
2320
The `token` field should include the JSON web token with the following claims:
2421

2522
* A claim that encodes the local part of the user ID is required. By default,

synapse/rest/client/login.py

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,7 @@ class LoginRestServlet(RestServlet):
6969
SSO_TYPE = "m.login.sso"
7070
TOKEN_TYPE = "m.login.token"
7171
JWT_TYPE = "org.matrix.login.jwt"
72-
JWT_TYPE_DEPRECATED = "m.login.jwt"
7372
APPSERVICE_TYPE = "m.login.application_service"
74-
APPSERVICE_TYPE_UNSTABLE = "uk.half-shot.msc2778.login.application_service"
7573
REFRESH_TOKEN_PARAM = "refresh_token"
7674

7775
def __init__(self, hs: "HomeServer"):
@@ -126,7 +124,6 @@ def on_GET(self, request: SynapseRequest) -> Tuple[int, JsonDict]:
126124
flows: List[JsonDict] = []
127125
if self.jwt_enabled:
128126
flows.append({"type": LoginRestServlet.JWT_TYPE})
129-
flows.append({"type": LoginRestServlet.JWT_TYPE_DEPRECATED})
130127

131128
if self.cas_enabled:
132129
# we advertise CAS for backwards compat, though MSC1721 renamed it
@@ -156,7 +153,6 @@ def on_GET(self, request: SynapseRequest) -> Tuple[int, JsonDict]:
156153
flows.extend({"type": t} for t in self.auth_handler.get_supported_login_types())
157154

158155
flows.append({"type": LoginRestServlet.APPSERVICE_TYPE})
159-
flows.append({"type": LoginRestServlet.APPSERVICE_TYPE_UNSTABLE})
160156

161157
return 200, {"flows": flows}
162158

@@ -175,10 +171,7 @@ async def on_POST(self, request: SynapseRequest) -> Tuple[int, LoginResponse]:
175171
)
176172

177173
try:
178-
if login_submission["type"] in (
179-
LoginRestServlet.APPSERVICE_TYPE,
180-
LoginRestServlet.APPSERVICE_TYPE_UNSTABLE,
181-
):
174+
if login_submission["type"] == LoginRestServlet.APPSERVICE_TYPE:
182175
appservice = self.auth.get_appservice_by_req(request)
183176

184177
if appservice.is_rate_limited():
@@ -191,9 +184,9 @@ async def on_POST(self, request: SynapseRequest) -> Tuple[int, LoginResponse]:
191184
appservice,
192185
should_issue_refresh_token=should_issue_refresh_token,
193186
)
194-
elif self.jwt_enabled and (
195-
login_submission["type"] == LoginRestServlet.JWT_TYPE
196-
or login_submission["type"] == LoginRestServlet.JWT_TYPE_DEPRECATED
187+
elif (
188+
self.jwt_enabled
189+
and login_submission["type"] == LoginRestServlet.JWT_TYPE
197190
):
198191
await self._address_ratelimiter.ratelimit(None, request.getClientIP())
199192
result = await self._do_jwt_login(

tests/handlers/test_password_providers.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,9 @@
3030
from tests.test_utils import make_awaitable
3131
from tests.unittest import override_config
3232

33-
# (possibly experimental) login flows we expect to appear in the list after the normal
34-
# ones
33+
# Login flows we expect to appear in the list after the normal ones.
3534
ADDITIONAL_LOGIN_FLOWS = [
3635
{"type": "m.login.application_service"},
37-
{"type": "uk.half-shot.msc2778.login.application_service"},
3836
]
3937

4038
# a mock instance which the dummy auth providers delegate to, so we can see what's going

tests/rest/client/test_login.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,11 +81,9 @@
8181
# the query params in TEST_CLIENT_REDIRECT_URL
8282
EXPECTED_CLIENT_REDIRECT_URL_PARAMS = [("<ab c>", ""), ('q" =+"', '"fö&=o"')]
8383

84-
# (possibly experimental) login flows we expect to appear in the list after the normal
85-
# ones
84+
# Login flows we expect to appear in the list after the normal ones.
8685
ADDITIONAL_LOGIN_FLOWS = [
8786
{"type": "m.login.application_service"},
88-
{"type": "uk.half-shot.msc2778.login.application_service"},
8987
]
9088

9189

0 commit comments

Comments
 (0)