. * */ require_once('User/backend.php'); 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 ){ global $WEBROOT; // 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"] . $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=OC_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; } } } ?>