. * */ require_once('class.openid.v3.php'); /** * Class for user management in a SQL Database (e.g. MySQL, SQLite) */ class OC_USER_OPENID extends OC_User_Backend { /** * @brief Check if the password is correct * @param $uid The username * @param $password The password * @returns true/false * * Check if the password is correct without logging in the user */ public function checkPassword( $uid, $password ){ // Get identity from user and redirect browser to OpenID Server $openid = new SimpleOpenID; $openid->SetIdentity($uid); $openid->SetTrustRoot('http://' . $_SERVER["HTTP_HOST"]); if ($openid->GetOpenIDServer()){ $openid->SetApprovedURL('http://' . $_SERVER["HTTP_HOST"] . OC::$WEBROOT); // Send Response from OpenID server to this script $openid->Redirect(); // This will redirect user to OpenID Server exit; }else{ return false; } exit; } /** * find the user that can be authenticated with an openid identity */ public static function findUserForIdentity($identity){ $query=OCP\DB::prepare('SELECT userid FROM *PREFIX*preferences WHERE appid=? AND configkey=? AND configvalue=?'); $result=$query->execute(array('user_openid','identity',$identity))->fetchAll(); if(count($result)>0){ return $result[0]['userid']; }else{ return false; } } } ?>