async def get_current_user(
        self,
        security_scopes: SecurityScopes,  # noqa
        request: Request,
        db: AsyncSession = Depends(get_async_db),
        _api_key: Optional[str] = Depends(APIKeyAuthenticationBackend.scheme),
        _bearer: Optional[str] = Depends(BearerTokenAuthenticationBackend.scheme),
    ) -> User:
        """Get the current user from the request."""

        userinfo = await self._authenticate_request_user(db, request)
        if not userinfo:
            raise UnauthorizedError()

        user = await accounts.get_user_by_username(db, userinfo.username)
        if not user:
            raise UnauthorizedError()

        set_request_user(request, user)
        return user
Get the current user from the request.
argilla-server/src/argilla_server/security/authentication/provider.py