summaryrefslogtreecommitdiff
path: root/modules/openid/tests
diff options
context:
space:
mode:
authorwebchick <webchick@24967.no-reply.drupal.org>2011-09-05 12:05:12 -0700
committerwebchick <webchick@24967.no-reply.drupal.org>2011-09-05 12:05:12 -0700
commit9d35f2586c50094f8caa2ad0f1c43facbbabe027 (patch)
tree42b1aa98fe334dbb16eed8a4ad609e4c55626388 /modules/openid/tests
parent81bf47868ea69c5cc2cbf90be8cecb2d5549e88b (diff)
downloadbrdo-9d35f2586c50094f8caa2ad0f1c43facbbabe027.tar.gz
brdo-9d35f2586c50094f8caa2ad0f1c43facbbabe027.tar.bz2
Issue #575810 by wojtha, Heine, vzima: Fixed OpenID discovery spec violation - follow redirects.
Diffstat (limited to 'modules/openid/tests')
-rw-r--r--modules/openid/tests/openid_test.module35
1 files changed, 35 insertions, 0 deletions
diff --git a/modules/openid/tests/openid_test.module b/modules/openid/tests/openid_test.module
index bad1184a3..629dcd335 100644
--- a/modules/openid/tests/openid_test.module
+++ b/modules/openid/tests/openid_test.module
@@ -60,6 +60,19 @@ function openid_test_menu() {
'access callback' => TRUE,
'type' => MENU_CALLBACK,
);
+ $items['openid-test/redirect'] = array(
+ 'title' => 'OpenID Provider Redirection Point',
+ 'page callback' => 'openid_test_redirect',
+ 'access callback' => TRUE,
+ 'type' => MENU_CALLBACK,
+ );
+ $items['openid-test/redirected/%/%'] = array(
+ 'title' => 'OpenID Provider Final URL',
+ 'page callback' => 'openid_test_redirected_method',
+ 'page arguments' => array(2, 3),
+ 'access callback' => TRUE,
+ 'type' => MENU_CALLBACK,
+ );
return $items;
}
@@ -213,6 +226,28 @@ function openid_test_endpoint() {
}
/**
+ * Menu callback; redirect during Normalization/Discovery.
+ */
+function openid_test_redirect($count = 0) {
+ if ($count == 0) {
+ $url = variable_get('openid_test_redirect_url', '');
+ }
+ else {
+ $url = url('openid-test/redirect/' . --$count, array('absolute' => TRUE));
+ }
+ $http_response_code = variable_get('openid_test_redirect_http_reponse_code', 301);
+ header('Location: ' . $url, TRUE, $http_response_code);
+ exit();
+}
+
+/**
+ * Menu callback; respond with appropriate callback.
+ */
+function openid_test_redirected_method($method1, $method2) {
+ return call_user_func('openid_test_' . $method1 . '_' . $method2);
+}
+
+/**
* OpenID endpoint; handle "associate" requests (see OpenID Authentication 2.0,
* section 8).
*