openid_protocol = $openid_protocol; $this->memento_service = $memento_service; } /** * @return OpenIdResponse * @throws Exception * @throws InvalidOpenIdMessageException */ public function endpoint() { $msg = new OpenIdMessage( Input::all() ); if($this->memento_service->exists()){ $msg = OpenIdMessage::buildFromMemento( $this->memento_service->load()); } if (!$msg->isValid()) throw new InvalidOpenIdMessageException(OpenIdErrorMessages::InvalidOpenIdMessage); //get response and manage it taking in consideration its type (direct or indirect) $response = $this->openid_protocol->handleOpenIdMessage($msg); if ($response instanceof OpenIdResponse) { $strategy = OpenIdResponseStrategyFactoryMethod::buildStrategy($response); return $strategy->handle($response); } return $response; } }