TYPO3 API  SVNRelease
Extension.php
Go to the documentation of this file.
00001 <?php
00002 
00003 /**
00004  * An interface for OpenID extensions.
00005  *
00006  * @package OpenID
00007  */
00008 
00009 /**
00010  * Require the Message implementation.
00011  */
00012 require_once 'Auth/OpenID/Message.php';
00013 
00014 /**
00015  * A base class for accessing extension request and response data for
00016  * the OpenID 2 protocol.
00017  *
00018  * @package OpenID
00019  */
00020 class Auth_OpenID_Extension {
00021     /**
00022      * ns_uri: The namespace to which to add the arguments for this
00023      * extension
00024      */
00025     var $ns_uri = null;
00026     var $ns_alias = null;
00027 
00028     /**
00029      * Get the string arguments that should be added to an OpenID
00030      * message for this extension.
00031      */
00032     function getExtensionArgs()
00033     {
00034         return null;
00035     }
00036 
00037     /**
00038      * Add the arguments from this extension to the provided message.
00039      *
00040      * Returns the message with the extension arguments added.
00041      */
00042     function toMessage(&$message)
00043     {
00044         $implicit = $message->isOpenID1();
00045         $added = $message->namespaces->addAlias($this->ns_uri,
00046                                                 $this->ns_alias,
00047                                                 $implicit);
00048 
00049         if ($added === null) {
00050             if ($message->namespaces->getAlias($this->ns_uri) !=
00051                 $this->ns_alias) {
00052                 return null;
00053             }
00054         }
00055 
00056         $message->updateArgs($this->ns_uri,
00057                              $this->getExtensionArgs());
00058         return $message;
00059     }
00060 }
00061 
00062 ?>