Laith- / lightopenid

Automatically exported from code.google.com/p/lightopenid
0 stars 0 forks source link

not valid with yandex & optional #10

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
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...

Original issue reported on code.google.com by ncwl...@gmail.com on 14 Oct 2010 at 1:47

GoogleCodeExporter commented 9 years ago
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.

Original comment by mewp...@gmail.com on 14 Oct 2010 at 2:16

GoogleCodeExporter commented 9 years ago
http://guildland.ru/openid/example.php
i use your example. yandex returns nickname & email, but the validation returns 
false

Original comment by ncwl...@gmail.com on 15 Oct 2010 at 7:32

Attachments:

GoogleCodeExporter commented 9 years ago
User has not logged in.array(2) { ["contact/email"]=> string(18) "xxxxx" 
["namePerson/friendly"]=> string(7) "ErgallM" }

Original comment by ncwl...@gmail.com on 15 Oct 2010 at 7:33

GoogleCodeExporter commented 9 years ago
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?

Original comment by mewp...@gmail.com on 15 Oct 2010 at 5:54

GoogleCodeExporter commented 9 years ago
i reg. test user.

login: cool.test-2011[dog]yandex.ru, p: test_2010

Original comment by ncwl...@gmail.com on 18 Oct 2010 at 5:47

GoogleCodeExporter commented 9 years ago
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.

Original comment by mewp...@gmail.com on 18 Oct 2010 at 9:40

GoogleCodeExporter commented 9 years ago
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

Original comment by ncwl...@gmail.com on 19 Oct 2010 at 5:30

GoogleCodeExporter commented 9 years ago
No idea why. Try to download again, I've reuploaded it.

Original comment by mewp...@gmail.com on 19 Oct 2010 at 8:42

GoogleCodeExporter commented 9 years ago
unpacked by 7za)
v0.3 works with yandex) thanks)

Original comment by ncwl...@gmail.com on 19 Oct 2010 at 8:49

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Good to know.

Original comment by mewp...@gmail.com on 19 Oct 2010 at 9:05