function DoLogin() { SysLog::Instance()->log('Login(sso)::DoLogin', "login"); $ssoclient = SsoClient::Instance(); SysLog::Instance()->log('Login(sso)::DoLogin poke me!!', "login"); // echo "Is sso alive? "; // var_dump($ssoclient->isSsoAlive()); // die(); $SsoAuth = $ssoclient->authenticateSsoUser($this->mUsername, $this->mPassword, $this->mSsoSystemId); // echo "<pre>"; // var_dump($SsoAuth); // echo "</pre>"; // die(); SysLog::Instance()->log("DoLogin got SsoAuth: " . print_r($SsoAuth, true), "login"); if ($SsoAuth['status'] === true) { // save SSID $ssoclient->saveSsIdToLocal($SsoAuth['ssid'], Configuration::Instance()->GetValue('application', 'sso_group')); // request details on SSID $SsoAttr = $ssoclient->requestSsIdAttributes($SsoAuth['ssid'], $this->mSsoSystemId); SysLog::Instance()->log("DoLogin got SsoAttr: " . print_r($SsoAttr, true), "login"); $local_username = $SsoAttr['mSsoLocalUsername']; $this->mUser->mUserName = $local_username; $this->mUser->GetUser(); } // echo "<pre>"; // var_dump($SsoAttr); // echo "</pre>"; // die($local_username); return $SsoAuth['status']; }
function DoLogout() { SysLog::Instance()->log('DoLogout sso', 'login'); $ssoclient = SsoClient::Instance(); $ssid = $ssoclient->getLocalSsId(Configuration::Instance()->GetValue('application', 'sso_group')); $result = $ssoclient->invalidateSsId($ssid); SysLog::Instance()->log('DoLogout sso invalidate result' . print_r($result, true), 'login'); $result2 = $ssoclient->removeLocalSsId(Configuration::Instance()->GetValue('application', 'sso_group')); SysLog::Instance()->log('DoLogout sso removeLocalSsId result' . print_r($result2, true), 'login'); return $result; }
<?php require_once "user.php"; $userKey = $_GET['sso']; $client = new SsoClient(); $response = $client->ssoLogin($userKey); if (!isset($response->error)) { $userService->login($response->data->username, $response->data->email); $userService->flashMessage("Sucessfully logged in!"); } else { $userService->flashMessage("Error: " . $response->error->message); } header('Location: index.php');