mirror of
https://git.anonymousland.org/anonymousland/synapse-product.git
synced 2025-05-02 11:26:05 -04:00
Move methods involving event authentication to EventAuthHandler. (#10268)
Instead of mixing them with user authentication methods.
This commit is contained in:
parent
0aab50c772
commit
8d609435c0
11 changed files with 112 additions and 106 deletions
|
@ -385,6 +385,7 @@ class EventCreationHandler:
|
|||
def __init__(self, hs: "HomeServer"):
|
||||
self.hs = hs
|
||||
self.auth = hs.get_auth()
|
||||
self._event_auth_handler = hs.get_event_auth_handler()
|
||||
self.store = hs.get_datastore()
|
||||
self.storage = hs.get_storage()
|
||||
self.state = hs.get_state_handler()
|
||||
|
@ -597,7 +598,7 @@ class EventCreationHandler:
|
|||
(e.type, e.state_key): e.event_id for e in auth_events
|
||||
}
|
||||
# Actually strip down and use the necessary auth events
|
||||
auth_event_ids = self.auth.compute_auth_events(
|
||||
auth_event_ids = self._event_auth_handler.compute_auth_events(
|
||||
event=temp_event,
|
||||
current_state_ids=auth_event_state_map,
|
||||
for_verification=False,
|
||||
|
@ -1056,7 +1057,9 @@ class EventCreationHandler:
|
|||
assert event.content["membership"] == Membership.LEAVE
|
||||
else:
|
||||
try:
|
||||
await self.auth.check_from_context(room_version, event, context)
|
||||
await self._event_auth_handler.check_from_context(
|
||||
room_version, event, context
|
||||
)
|
||||
except AuthError as err:
|
||||
logger.warning("Denying new event %r because %s", event, err)
|
||||
raise err
|
||||
|
@ -1381,7 +1384,7 @@ class EventCreationHandler:
|
|||
raise AuthError(403, "Redacting server ACL events is not permitted")
|
||||
|
||||
prev_state_ids = await context.get_prev_state_ids()
|
||||
auth_events_ids = self.auth.compute_auth_events(
|
||||
auth_events_ids = self._event_auth_handler.compute_auth_events(
|
||||
event, prev_state_ids, for_verification=True
|
||||
)
|
||||
auth_events_map = await self.store.get_events(auth_events_ids)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue