memento_service = $memento_service; parent::__construct($user_action_service, $auth_service); } public function getLogin() { if (Auth::guest()) { $msg = OpenIdMessage::buildFromMemento($this->memento_service->load()); $auth_request = new OpenIdAuthenticationRequest($msg); $params = array('realm' => $auth_request->getRealm()); if (!$auth_request->isIdentitySelectByOP()) { $params['claimed_id'] = $auth_request->getClaimedId(); $params['identity'] = $auth_request->getIdentity(); $params['identity_select'] = false; } else { $params['identity_select'] = true; } $params['supported_providers'] = SocialLoginProviders::buildSupportedProviders(); return View::make("auth.login", $params); } return Redirect::action("UserController@getProfile"); } public function postLogin(array $params = []) { //go to authentication flow again $msg = OpenIdMessage::buildFromMemento($this->memento_service->load()); $realm = "From ". $msg->getParam(OpenIdProtocol::OpenIDProtocol_Realm); if(isset($params['provider'])) $realm .= " using ".strtoupper($params['provider']); $this->user_action_service->addUserAction ( $this->auth_service->getCurrentUser()->getId(), IPHelper::getUserIp(), IUserActionService::LoginAction, $realm ); return Redirect::action("OpenId\OpenIdProviderController@endpoint"); } public function cancelLogin() { $this->auth_service->setUserAuthenticationResponse(IAuthService::AuthenticationResponse_Cancel); return Redirect::action("OpenId\OpenIdProviderController@endpoint"); } }