Your using Solar and decide you need OpenID support but Solar doesn't have an Adapter for that! What are you to do!

Solar makes heavy use of Adapter based classes, Solar_Auth is one of these. This makes adding additional methods pretty easy and allows you to borrow from other Frameworks without having to Hack in a third party auth setup, You can use the basics provided by Solar.

So, in this example we are going to use Zend_OpenId which is a bit out of date as far as OpenID standards go and we have a few local "hacks" to work around some of those issues but we are going to stick to the "Short" of it here.

class App_Auth_Adapter_OpenID extends Solar_Auth_Adapter
{
    protected $_consumer; // We need to keep the Zend consumer class available
    protected $_reg_info; // same for Sref extension
   
   
    /**
     *
     * Handle Openid login,
     *
     * @return array Info needed to login
     *
     */
 
    protected function _processLogin()
    {
        $id = "";
        $result = false;
        if ($this->_consumer->verify($this->_request->get(), $id, $this->_reg_info)) {          
            $props = $this->_reg_info->getProperties();
        }
        if (! is_array($props)) {
            // Authentication failed
            return $result;
        }      
        // complete login
        return array(
            'handle'    => $props['nickname'], // username
            'email'     => $props['email'], // email    
            'moniker'   => $props['nick'], //    
        );
    }
   
    /**
     *
     * Have we gotten a saml Response?
     *
     * @return bool
     *
     */
       
    public function isLoginRequest() {
        // Is this an openid request
        if ($this->_request->post('openid_id') || $this->_request->get('openid_mode')) {
            // We are in some sort of openid request, lets get the class
            $storage = new Zend_OpenId_Consumer_Storage();
            $this->_consumer = new Zend_OpenID_Consumer($storage);
            $this->_reg_info = new Zend_OpenID_Extension_Sreg(array(
                            'nickname'  => false,
                            'email'     => false,
                            'fullname'  => false,
                        ));
            // This isn't a login request, its the initial openid build request.. Lets execute login
            if ($this->_request->post('openid_id')) {
                try {
                    if (! $this->_consumer->login($this->_request->post('openid_id'), NULL, NULL, $this->_reg_info)) {
                        echo $this->_consumer->getError();
                    }  
                } catch (Exception $e) {
                    echo $e;
                }
            } else {
                return true;
            }
        }
        return false;
    }

}

Form to go with the above code

<form method="post">
<fieldset>
<legend>OpenID Login</legend>
<input type="text" name="openid_id" value=""/>
<input type="submit" name="openid_action" value="login"/>
</fieldset>
</form>

Again the ZF OpenID library is a bit behind, this doesn't work with all sites.. You can download the adapter at SFER

http://code.google.com/p/sfer/source/browse/trunk/Sfer/Auth/Adapter/Open...

And I will get some demo code up shortly