summaryrefslogtreecommitdiff
path: root/extlib/Auth/OpenID/Extension.php
diff options
context:
space:
mode:
authorEvan Prodromou <evan@prodromou.name>2008-08-22 09:17:14 -0400
committerEvan Prodromou <evan@prodromou.name>2008-08-22 09:17:14 -0400
commit14c9366aac697e87499c5748b36fa7bf5e6cd320 (patch)
tree75cfb4355bb5200e3c505f49532b0d934261a8e9 /extlib/Auth/OpenID/Extension.php
parentdfdc8b777345875fb1d367ce3b9c91b372cd4dc3 (diff)
include external libs in a subdir to make install easier
darcs-hash:20080822131714-84dde-6978424ded2ed1041a65142a25560654ac717fcd.gz
Diffstat (limited to 'extlib/Auth/OpenID/Extension.php')
-rw-r--r--extlib/Auth/OpenID/Extension.php62
1 files changed, 62 insertions, 0 deletions
diff --git a/extlib/Auth/OpenID/Extension.php b/extlib/Auth/OpenID/Extension.php
new file mode 100644
index 000000000..f362a4b38
--- /dev/null
+++ b/extlib/Auth/OpenID/Extension.php
@@ -0,0 +1,62 @@
+<?php
+
+/**
+ * An interface for OpenID extensions.
+ *
+ * @package OpenID
+ */
+
+/**
+ * Require the Message implementation.
+ */
+require_once 'Auth/OpenID/Message.php';
+
+/**
+ * A base class for accessing extension request and response data for
+ * the OpenID 2 protocol.
+ *
+ * @package OpenID
+ */
+class Auth_OpenID_Extension {
+ /**
+ * ns_uri: The namespace to which to add the arguments for this
+ * extension
+ */
+ var $ns_uri = null;
+ var $ns_alias = null;
+
+ /**
+ * Get the string arguments that should be added to an OpenID
+ * message for this extension.
+ */
+ function getExtensionArgs()
+ {
+ return null;
+ }
+
+ /**
+ * Add the arguments from this extension to the provided message.
+ *
+ * Returns the message with the extension arguments added.
+ */
+ function toMessage(&$message)
+ {
+ $implicit = $message->isOpenID1();
+ $added = $message->namespaces->addAlias($this->ns_uri,
+ $this->ns_alias,
+ $implicit);
+
+ if ($added === null) {
+ if ($message->namespaces->getAlias($this->ns_uri) !=
+ $this->ns_alias) {
+ return null;
+ }
+ }
+
+ $message->updateArgs($this->ns_uri,
+ $this->getExtensionArgs());
+ return $message;
+ }
+}
+
+?> \ No newline at end of file