Issue 10: not valid with yandex & optional
Status:  Done
Owner: ----
Closed:  Oct 2010
Reported by ncwl...@gmail.com, Oct 14, 2010
my class

class Ncw_OpenID extends LightOpenID
{
    const OPENID_MODE_CANCEL = 'cancel';

    /**
     * @todo Не работает авторизация с параметрами
     */
    public function __construct()
    {
        parent::__construct();
        $this->required = array('namePerson/friendly', 'contact/email');
        $this->optional = array('contact/email');
    }

    public function  getAttributes() {
        $attr = parent::getAttributes();
        $newAttr = array();
        foreach ($attr as $key => $value) {
            if (isset(parent::$ax_to_sreg[$key])) $key = parent::$ax_to_sreg[$key];
            $newAttr[$key] = $value;
        }
        return $newAttr;
    }
}

$openid->validate() return false, if i comment
//$this->required = array('namePerson/friendly', 'contact/email');
//$this->optional = array('contact/email');
openid work...
Oct 14, 2010
Project Member #1 mewp...@gmail.com
Could you tell me exactly what is the problem, and steps to reproduce it?

From what I can tell from your code, you get wrong keys for attributes, but I have no idea why that might be, and without ability to reproduce I can't properly fix it.
Oct 15, 2010
#2 ncwl...@gmail.com
http://guildland.ru/openid/example.php
i use your example. yandex returns nickname & email, but the validation returns false
example.php
1.1 KB   View   Download
Oct 15, 2010
#3 ncwl...@gmail.com
User has not logged in.array(2) { ["contact/email"]=> string(18) "xxxxx" ["namePerson/friendly"]=> string(7) "ErgallM" }
Oct 15, 2010
Project Member #4 mewp...@gmail.com
Well, the validation could return false even if attributes are returned.

Unfortunately, I can't easily register or test authentication with yandex.ru, since I don't know russian at all.

Could you verify that the other consumers don't have the problem (like stackoverflow.com, for example)? If it is indeed a problem related to LightOpenID, could you please guide me through authentication with yandex.ru (with some test login), so that I can test it myself?
Oct 17, 2010
#5 ncwl...@gmail.com
i reg. test user.

login: cool.test-2011[dog]yandex.ru, p: test_2010
Oct 18, 2010
Project Member #6 mewp...@gmail.com
I can not reproduce the error.
I've copied and pasted your example, and it works fine for me, using the latest version from gitorious. However, it seems that v0.2 that you're able to download from here doesn't work indeed.

My advice is: upgrade. I've posted lightopenid-0.3 for download here, it should work for you. Please confirm that everything is fine, so I can close the bug.

By the way:
1. Don't specify contact/email both in required and optional -- it's treated just like required.
2. Don't specify required and optional before validation -- it's not necessary. Those are needed only to tell the OP that we want the attributes. Later, when it has already resopnded, LightOpenID returns all avaiable attributes regardless of whether they are required/optional or not.
Oct 18, 2010
#7 ncwl...@gmail.com
i can't open new version, archive error:

gzip: stdin: not in gzip format
tar: Child returned status 1
tar: Exiting with failure status due to previous errors
Oct 19, 2010
Project Member #8 mewp...@gmail.com
No idea why. Try to download again, I've reuploaded it.
Oct 19, 2010
#9 ncwl...@gmail.com
unpacked by 7za)
v0.3 works with yandex) thanks)
Oct 19, 2010
Project Member #11 mewp...@gmail.com
Good to know.
Status: Done