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

Clean up synapse.api.auth.Auth #13019

@sandhose

Description

@sandhose

I'm trying to make sense to what is in synapse.api.auth.Auth.
The goal is to extract a clear interface for verifying access tokens, so we can override that more easily for the OIDC work.

I already cleaned up things related to access token verification & macaroons in #12986

I'm finding a few method types:

  • things related to checking if a user can do something:
    • check_user_in_room_or_world_readable
    • check_can_change_room_list
    • check_user_in_room
    • is_server_admin
  • static methods to get the access token in a request
    • has_access_token
    • get_access_token_from_request
  • methods to get the requester of a request
    • get_user_by_access_token
    • get_user_by_req
    • get_appservice_by_req

There is also check_auth_blocking, which only acts as a proxy to AuthBlocking.check_auth_blocking.
Note that is_server_admin is also a simple proxy to RegistrationWorkerStore.is_server_admin.

The other interesting thing I found out is that check_user_in_room is called from three places:

  • check_user_in_room_or_world_readable (which makes sense)
  • in handlers related to typing notifications (which also makes sense, since you can't send typing notifications in rooms you're not in)
  • in rest.client.room.TimestampLookupRestServlet, which looks like an oversight, and should probably call check_user_in_room_or_world_readable instead

Other interesting things about a method: get_appservice_by_req is called from three places:

So, what I would like to do is:

Metadata

Metadata

Assignees

Labels

T-TaskRefactoring, removal, replacement, enabling or disabling functionality, other engineering tasks.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions