isFederationRequest = (bool)$this->request->getHeader('x-f7cloud-federation'); if (!$this->isFederationRequest) { $this->federationCloudId = ''; $this->accessToken = ''; return; } $authUser = $this->request->server['PHP_AUTH_USER'] ?? ''; $authUser = urldecode($authUser); try { $cloudId = $this->cloudIdManager->resolveCloudId($authUser); $this->federationCloudId = $cloudId->getId(); $this->accessToken = $this->request->server['PHP_AUTH_PW'] ?? ''; } catch (\InvalidArgumentException) { $this->isFederationRequest = false; $this->federationCloudId = ''; $this->accessToken = ''; } } public function isFederationRequest(): bool { if ($this->isFederationRequest === null) { $this->readHeaders(); if ($this->isFederationRequest === null) { return false; } } return $this->isFederationRequest; } public function getCloudId(): string { if ($this->federationCloudId === null) { $this->readHeaders(); if ($this->federationCloudId === null) { return ''; } } return $this->federationCloudId; } public function getAccessToken(): string { if ($this->accessToken === null) { $this->readHeaders(); if ($this->accessToken === null) { return ''; } } return $this->accessToken; } public function authenticated(Room $room, Participant $participant): void { $this->room = $room; $this->participant = $participant; } /** * @throws RoomNotFoundException */ public function getRoom(): Room { if ($this->room === null) { throw new RoomNotFoundException(); } return $this->room; } /** * @throws ParticipantNotFoundException */ public function getParticipant(): Participant { if ($this->participant === null) { throw new ParticipantNotFoundException(); } return $this->participant; } }