diff --git a/src/sentry/api/authentication.py b/src/sentry/api/authentication.py index 4f353e3bc1069f..3f7a259300cf5a 100644 --- a/src/sentry/api/authentication.py +++ b/src/sentry/api/authentication.py @@ -107,7 +107,7 @@ def is_static_relay(request): return relay_info is not None -def relay_from_id(request, relay_id) -> tuple[Relay | None, bool]: +def relay_from_id(request: Request, relay_id: str) -> tuple[Relay | None, bool]: """ Tries to find a Relay for a given id If the id is statically registered than no DB access will be done. @@ -210,9 +210,14 @@ def authenticate(self, request: Request): raise AuthenticationFailed("Missing relay signature") return self.authenticate_credentials(relay_id, relay_sig, request) - def authenticate_credentials(self, relay_id, relay_sig, request): + def authenticate_credentials( + self, relay_id: str, relay_sig: str, request=None + ) -> tuple[AnonymousUser, None]: Scope.get_isolation_scope().set_tag("relay_id", relay_id) + if request is None: + raise AuthenticationFailed("missing request") + relay, static = relay_from_id(request, relay_id) if relay is None: