public function httpGetForHtml() { $response = parent::httpGetForHtml(); $openIdMode = $this->getRequest()->getParameter('openid_mode'); if ($openIdMode) { switch ($openIdMode) { case 'cancel': // Identification by means of OpenID failed. throw new NotAuthenticatedException('OpenID athentication failed.'); case 'id_res': // The identity provider has validated the user, so it can // be set as current (as long as it's authorised). try { $user = Users::getFromIdentityProvider(new GoogleIdentityProvider()); Users::setCurrent($user); // Redirect users to either the URL they originally // requested, or to the index if the former is not // available. $response = new Redirection($this->getRequest()); $response->setNextUrl(Application::getCurrent()->popLastLocator() ?: '/'); } catch (NotAuthenticatedException $exception) { // The current OpenID data is not valid. Request again. $response = $this->getRequestIdentificationResponse(); } break; default: throw new NotAuthenticatedException('Unsupported OpenID mode.'); } } else { // No OpenID response is present, so just ask for identity. $response = $this->getRequestIdentificationResponse(); } return $response; }