Using OpenID with Simple Extension.

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Using OpenID with Simple Extension.

Eric Naujock
I have been working with the OpeID extension tothe Zend Auth  
component. Up to now I can login using the openID component but for  
some reason I cannot get the Extension to be returned.

I am using the following extension

                        $this->sreg = new Zend_OpenId_Extension_Sreg(array(
                                'nickname'=>false,
                                'email'=>false,
                                'fullname'=>false), null, 1.1);

and use the following code to check my ID.

                        if ((isset($_POST['openid_action']) && $_POST['openid_action'] ==  
"login" && !empty($_POST['openid_identifier'])) ||
                                        isset($_GET['openid_mode'])) {
                                $adapter = new Zend_Auth_Adapter_OpenId(@
$_POST['openid_identifier'],$this->storage,null,null, $this->sreg);
                                $result = $this->auth->authenticate($adapter);
                                if ($result->isValid()) {
                                        Zend_OpenId::redirect(Zend_OpenId::selfURL());
                                } else {
                                        $auth->clearIdentity();
                                        foreach ($result->getMessages() as $message) {
                                                $this->view->message .= "$message<br>\n";
                                        }
                                }
                        } else if ($this->auth->hasIdentity()) {
                                if (isset($_POST['openid_action']) &&
                                        $_POST['openid_action'] == "logout") {
                                        $this->auth->clearIdentity();
                                } else {
                                        $this->view->message .= "You are logged-in as " . $this->auth-
 >getIdentity() . "<br>\n";
                                // if ($this->consumer->verify($_GET, $id, $this->sreg)) {
                                // $this->view->message .= "VALID $id";
                                                $data = $this->sreg->getProperties();
                                // } else {
                                // $this->view->message .= "INVALID $id";
                                // $data = $this->auth->getIdentity();
                                // }
                                // $this->auth->getStorage()->write($data);
                                        Zend_Registry::set('authUser', $data);
                                        echo '<pre>';
                                        print_r ($data);
                                        echo '</pre>';
                                }
                        }

When I remove the comments I am unable to retrieve the fullname,  
nickname or e-mail address.  When using the Zend_Auth_Adapter_OpenId  
how do I retrieve the extensions information.

Thanks in advance.
Eric Naujock


Reply | Threaded
Open this post in threaded view
|

Re: Using OpenID with Simple Extension.

help_poor
Hello Eric,

Sorry repeating with you. Did ZF openid worked for you ? With simple a,b,c example ? Instead of this mess code with Yahoo/Google/Aol/Facebook/all the rest...... ????

Thanks