Compare commits

...

2 Commits

Author SHA1 Message Date
Will Hunt bcb63c8ef5 Move constant to correct location 2020-09-16 18:57:45 +01:00
Will Hunt c3c1cc7162 Match MSC 2020-09-16 18:20:07 +01:00
2 changed files with 7 additions and 2 deletions

View File

@ -57,7 +57,6 @@ class JoinRules:
class LoginType:
PASSWORD = "m.login.password"
APPSERVICE = "uk.half-shot.unstable.login.appservice"
EMAIL_IDENTITY = "m.login.email.identity"
MSISDN = "m.login.msisdn"
RECAPTCHA = "m.login.recaptcha"

View File

@ -41,6 +41,7 @@ logger = logging.getLogger(__name__)
class LoginRestServlet(RestServlet):
PATTERNS = client_patterns("/login$", v1=True)
APPSERVICE_TYPE = "uk.half-shot.msc2778.login.application_service"
CAS_TYPE = "m.login.cas"
SSO_TYPE = "m.login.sso"
TOKEN_TYPE = "m.login.token"
@ -240,7 +241,12 @@ class LoginRestServlet(RestServlet):
else:
qualified_user_id = UserID(identifier["user"], self.hs.hostname).to_string()
if login_submission["type"] == LoginType.APPSERVICE and appservice is not None:
if login_submission["type"] == LoginRestServlet.APPSERVICE_TYPE:
if appservice is None or not appservice.is_interested_in_user(
qualified_user_id
):
raise LoginError(403, "Invalid access_token", errcode=Codes.FORBIDDEN)
result = await self._complete_login(qualified_user_id, login_submission)
return result