[BUGFIX] Fix T3editor after PSR-7 change
[Packages/TYPO3.CMS.git] / typo3 / sysext / openid / lib / php-openid / Auth / OpenID / Extension.php
1 <?php
2
3 /**
4 * An interface for OpenID extensions.
5 *
6 * @package OpenID
7 */
8
9 /**
10 * Require the Message implementation.
11 */
12 require_once 'Auth/OpenID/Message.php';
13
14 /**
15 * A base class for accessing extension request and response data for
16 * the OpenID 2 protocol.
17 *
18 * @package OpenID
19 */
20 class Auth_OpenID_Extension {
21 /**
22 * ns_uri: The namespace to which to add the arguments for this
23 * extension
24 */
25 var $ns_uri = null;
26 var $ns_alias = null;
27
28 /**
29 * Get the string arguments that should be added to an OpenID
30 * message for this extension.
31 */
32 function getExtensionArgs()
33 {
34 return null;
35 }
36
37 /**
38 * Add the arguments from this extension to the provided message.
39 *
40 * Returns the message with the extension arguments added.
41 */
42 function toMessage($message, $request = null)
43 {
44 $implicit = $message->isOpenID1();
45 $added = $message->namespaces->addAlias($this->ns_uri,
46 $this->ns_alias,
47 $implicit);
48
49 if ($added === null) {
50 if ($message->namespaces->getAlias($this->ns_uri) !=
51 $this->ns_alias) {
52 return null;
53 }
54 }
55
56 if ($request !== null) {
57 $message->updateArgs($this->ns_uri,
58 $this->getExtensionArgs($request));
59 } else {
60 $message->updateArgs($this->ns_uri,
61 $this->getExtensionArgs());
62 }
63 return $message;
64 }
65 }
66