summaryrefslogtreecommitdiffstats
path: root/Auth
diff options
context:
space:
mode:
authortailor <cygnus@janrain.com>2007-09-20 18:44:45 +0000
committertailor <cygnus@janrain.com>2007-09-20 18:44:45 +0000
commit8888843a23401dd3b7e3f90c7f79a4caca9281fb (patch)
tree7625d54ccd22b9f29a1fbb4b3162f48c46bfd56e /Auth
parent773341140b8b9567543aef4899ef641d955a968c (diff)
downloadphp-openid-8888843a23401dd3b7e3f90c7f79a4caca9281fb.zip
php-openid-8888843a23401dd3b7e3f90c7f79a4caca9281fb.tar.gz
php-openid-8888843a23401dd3b7e3f90c7f79a4caca9281fb.tar.bz2
[project @ Removed sendSRegFields, added Auth_OpenID_Response.addExtension]
Diffstat (limited to 'Auth')
-rw-r--r--Auth/OpenID/SReg.php48
-rw-r--r--Auth/OpenID/Server.php5
2 files changed, 19 insertions, 34 deletions
diff --git a/Auth/OpenID/SReg.php b/Auth/OpenID/SReg.php
index 208a6ab..e1222aa 100644
--- a/Auth/OpenID/SReg.php
+++ b/Auth/OpenID/SReg.php
@@ -175,9 +175,10 @@ class Auth_OpenID_SRegRequest extends Auth_OpenID_SRegBase {
*/
function build($required=null, $optional=null,
$policy_url=null,
- $sreg_ns_uri=Auth_OpenID_SREG_NS_URI)
+ $sreg_ns_uri=Auth_OpenID_SREG_NS_URI,
+ $cls='Auth_OpenID_SRegRequest')
{
- $obj = new Auth_OpenID_SRegRequest();
+ $obj = new $cls();
$obj->required = array();
$obj->optional = array();
@@ -204,18 +205,23 @@ class Auth_OpenID_SRegRequest extends Auth_OpenID_SRegBase {
* that were requested in the OpenID request with the given
* arguments
*
- * $message: The arguments that were given for this OpenID
- * authentication request
+ * $request: The OpenID authentication request from which to
+ * extract an sreg request.
+ *
+ * $cls: name of class to use when creating sreg request object.
+ * Used for testing.
*
* Returns the newly created simple registration request
*/
- function fromOpenIDRequest($message)
+ function fromOpenIDRequest($request, $cls='Auth_OpenID_SRegRequest')
{
- $obj = Auth_OpenID_SRegRequest::build();
+
+ $obj = call_user_func_array(array($cls, 'build'),
+ array(null, null, null, Auth_OpenID_SREG_NS_URI, $cls));
// Since we're going to mess with namespace URI mapping, don't
// mutate the object that was passed in.
- $m = $message;
+ $m = $request->message;
$obj->ns_uri = $obj->_getSRegNS($m);
$args = $m->getArgs($obj->ns_uri);
@@ -512,30 +518,4 @@ class Auth_OpenID_SRegResponse extends Auth_OpenID_SRegBase {
}
}
-/**
- * Convenience function for copying all the sreg data that was
- * requested from a supplied set of sreg data into the response
- * message. If no data were requested, no data will be sent.
- *
- * openid_request: The OpenID (checkid_*) request that may be
- * requesting sreg data.
- *
- * data: The simple registration data to send. All requested fields
- * that are present in this dictionary will be added to the response
- * message.
- *
- * openid_response: The OpenID C{id_res} response to which the simple
- * registration data should be added
- *
- * Does not return a value; updates the openid_response instead.
- */
-function Auth_OpenID_sendSRegFields(&$openid_request, $data, &$openid_response)
-{
- $sreg_request = Auth_OpenID_SRegRequest::fromOpenIDRequest(
- $openid_request->message);
- $sreg_response = Auth_OpenID_SRegResponse::extractResponse(
- $sreg_request, $data);
- $sreg_response->toMessage($openid_response->fields);
-}
-
-?> \ No newline at end of file
+?>
diff --git a/Auth/OpenID/Server.php b/Auth/OpenID/Server.php
index 1308b2b..6e67e65 100644
--- a/Auth/OpenID/Server.php
+++ b/Auth/OpenID/Server.php
@@ -1153,6 +1153,11 @@ class Auth_OpenID_ServerResponse {
return $this->fields->toURL($this->request->return_to);
}
+ function addExtension($extension_response)
+ {
+ $extension_response->toMessage($this->fields);
+ }
+
function needsSigning()
{
return $this->fields->getArg(Auth_OpenID_OPENID_NS,