summaryrefslogtreecommitdiff
path: root/modules/openid/tests
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2010-03-22 18:48:20 +0000
committerDries Buytaert <dries@buytaert.net>2010-03-22 18:48:20 +0000
commite8d18e41fc25af8dad5746e5b3bd6982c2492c2e (patch)
treeea2f2bf94b63828003376e9d4ad3c5e18a27e474 /modules/openid/tests
parent2598778efa1887a4f2a8eb016114d32e8b6259a8 (diff)
downloadbrdo-e8d18e41fc25af8dad5746e5b3bd6982c2492c2e.tar.gz
brdo-e8d18e41fc25af8dad5746e5b3bd6982c2492c2e.tar.bz2
- Patch #218097 by c960657: OpenID must use canonical ID when authenticating XRI i-names.
Diffstat (limited to 'modules/openid/tests')
-rw-r--r--modules/openid/tests/openid_test.module21
1 files changed, 20 insertions, 1 deletions
diff --git a/modules/openid/tests/openid_test.module b/modules/openid/tests/openid_test.module
index e980bb6c8..db03641c5 100644
--- a/modules/openid/tests/openid_test.module
+++ b/modules/openid/tests/openid_test.module
@@ -69,10 +69,29 @@ function openid_test_menu() {
*/
function openid_test_yadis_xrds() {
if ($_SERVER['HTTP_ACCEPT'] == 'application/xrds+xml') {
+ // Only respond to XRI requests for one specific XRI. The is used to verify
+ // that the XRI has been properly encoded. The "+" sign in the _xrd_r query
+ // parameter is decoded to a space by PHP.
+ if (arg(3) == 'xri') {
+ if (variable_get('clean_url', 0)) {
+ if (arg(4) != '@example*résumé;%25' || $_GET['_xrd_r'] != 'application/xrds xml') {
+ drupal_not_found();
+ }
+ }
+ else {
+ // Drupal cannot properly emulate an XRI proxy resolver using unclean
+ // URLs, so the arguments gets messed up.
+ if (arg(4) . '/' . arg(5) != '@example*résumé;%25?_xrd_r=application/xrds xml') {
+ drupal_not_found();
+ }
+ }
+ }
drupal_add_http_header('Content-Type', 'application/xrds+xml');
print '<?xml version="1.0" encoding="UTF-8"?>
<xrds:XRDS xmlns:xrds="xri://$xrds" xmlns="xri://$xrd*($v*2.0)">
<XRD>
+ <ProviderID>xri://@</ProviderID>
+ <CanonicalID>http://example.com/user</CanonicalID>
<Service>
<Type>http://example.com/this-is-ignored</Type>
</Service>
@@ -102,7 +121,7 @@ function openid_test_yadis_xrds() {
</Service>';
}
print '
- <XRD>
+ </XRD>
</xrds:XRDS>';
}
else {