Use the SSO handler helpers for CAS registration/login. (#8856)

This commit is contained in:
Patrick Cloke 2021-01-03 11:25:44 -05:00 committed by GitHub
parent 168ba00d01
commit 0eccf53146
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 199 additions and 39 deletions

View file

@ -173,7 +173,7 @@ class SsoHandler:
request: SynapseRequest,
client_redirect_url: str,
sso_to_matrix_id_mapper: Callable[[int], Awaitable[UserAttributes]],
grandfather_existing_users: Optional[Callable[[], Awaitable[Optional[str]]]],
grandfather_existing_users: Callable[[], Awaitable[Optional[str]]],
extra_login_attributes: Optional[JsonDict] = None,
) -> None:
"""
@ -241,7 +241,7 @@ class SsoHandler:
)
# Check for grandfathering of users.
if not user_id and grandfather_existing_users:
if not user_id:
user_id = await grandfather_existing_users()
if user_id:
# Future logins should also match this user ID.