/** * Stores user identity * * @param \MongoId $userId * @param \Vegas\Security\OAuth\Identity $oAuthIdentity * @return bool */ public static function addUserIdentity(\MongoId $userId, \Vegas\Security\OAuth\Identity $oAuthIdentity) { $identity = new Identity(); $identity->writeAttribute('user_id', $userId); $identity->writeAttribute('id', $oAuthIdentity->getId()); $identity->writeAttribute('email', $oAuthIdentity->getEmail()); $identity->writeAttribute('service', $oAuthIdentity->getService()); return $identity->save(); }