commit 4baac21dd4abf2f56dc9770b121716f50e2696ad
Author: widukind
Date: Mon Jan 5 13:07:19 2015 -0800
erased anything related to forcing HTTPS from the module code.
diff --git a/simplesamlphp_auth.admin.inc b/simplesamlphp_auth.admin.inc
index 5d933cf..619ce7d 100644
--- a/simplesamlphp_auth.admin.inc
+++ b/simplesamlphp_auth.admin.inc
@@ -43,12 +43,6 @@ function simplesamlphp_auth_settings() {
'#default_value' => variable_get('simplesamlphp_auth_authsource', 'default-sp'),
'#description' => t('The name of the source to use from /var/simplesamlphp/config/authsources.php'),
);
- $form['simplesamlphp_auth_grp_setup']['simplesamlphp_auth_forcehttps'] = array(
- '#type' => 'checkbox',
- '#title' => t('Force https for login links'),
- '#default_value' => variable_get('simplesamlphp_auth_forcehttps', TRUE),
- '#description' => t('Should be enabled on production sites.'),
- );
$form['simplesamlphp_auth_grp_user'] = array(
'#type' => 'fieldset',
diff --git a/simplesamlphp_auth.install b/simplesamlphp_auth.install
index fe91369..f9a212d 100644
--- a/simplesamlphp_auth.install
+++ b/simplesamlphp_auth.install
@@ -38,7 +38,6 @@ function simplesamlphp_auth_uninstall() {
variable_del('simplesamlphp_auth_authsource');
variable_del('simplesamlphp_auth_rolepopulation');
variable_del('simplesamlphp_auth_roleevaleverytime');
- variable_del('simplesamlphp_auth_forcehttps');
variable_del('simplesamlphp_auth_registerusers');
variable_del('simplesamlphp_auth_allowsetdrupalpwd');
variable_del('simplesamlphp_auth_allowdefaultlogin');
diff --git a/simplesamlphp_auth.module b/simplesamlphp_auth.module
index 781ce3e..4934f73 100644
--- a/simplesamlphp_auth.module
+++ b/simplesamlphp_auth.module
@@ -28,27 +28,6 @@
* notices.
*/
-
-/**
- * Implements hook_url_inbound_alter().
- */
-function simplesamlphp_auth_url_inbound_alter(&$path, $original_path, $path_language) {
- if ('saml_login' === $path
- && !_simplesamlphp_auth_is_https_request()
- && variable_get('simplesamlphp_auth_forcehttps', FALSE)
- ) {
-
- $options = array('absolute' => TRUE);
- if (isset($_GET['destination'])) {
- $options['query']['destination'] = $_GET['destination'];
- unset($_GET['destination']);
- }
- $url = _simplesamlphp_auth_forcehttps_rewrite(url($path, $options));
-
- drupal_goto($url);
- }
-}
-
/**
* Implements hook_menu().
*/
@@ -487,20 +466,15 @@ function simplesamlphp_auth_form_alter(&$form, $form_state, $form_id) {
return;
}
- $options = array();
- if (variable_get('simplesamlphp_auth_forcehttps', FALSE)) {
- $options['https'] = TRUE;
- }
-
if ($form_id == 'user_login_block') {
- $link = l(t('Federated Log In'), 'saml_login', $options);
+ $link = l(t('Federated Log In'), 'saml_login');
$links = $form['links']['#markup'];
$links = str_replace('', '' . $link . '', $links);
$form['links']['#markup'] = $links;
}
if ($form_id == 'user_account_form') {
- $link = l(t('Federated Log In'), 'saml_login', $options);
+ $link = l(t('Federated Log In'), 'saml_login');
$links = $form['links']['#markup'];
$links = str_replace('', '' . $link . '', $links);
$form['links']['#markup'] = $links;
@@ -678,18 +652,6 @@ function _simplesamlphp_auth_get_mail() {
}
/**
- * Forces HTTPS connections.
- */
-function _simplesamlphp_auth_forcehttps_rewrite($url) {
- if (variable_get('simplesamlphp_auth_forcehttps', TRUE)) {
- $url = str_replace('http://', 'https://', $url);
- _simplesaml_auth_debug('forcehttps rewrite: ' . $url);
- }
-
- return $url;
-}
-
-/**
* Generates the text for the log in block.
*/
function _simplesamlphp_auth_generate_block_text() {
@@ -702,18 +664,13 @@ function _simplesamlphp_auth_generate_block_text() {
return;
}
- $options = array();
- if (variable_get('simplesamlphp_auth_forcehttps', FALSE)) {
- $options['https'] = TRUE;
- }
-
// Check if valid local session exists..
if ($_simplesamlphp_auth_as->isAuthenticated()) {
$block_content .= '' . t('Logged in as: @username', array('@username' => $user->name))
- . '
' . l(t('Log Out'), 'user/logout', $options) . '
';
+ . '
' . l(t('Log Out'), 'user/logout') . '
';
}
else {
- $block_content .= '' . l(t('Federated Log In'), 'saml_login', $options) . '
';
+ $block_content .= '' . l(t('Federated Log In'), 'saml_login') . '
';
}
return $block_content;
@@ -844,24 +801,6 @@ function _simplesamlphp_auth_destroy_drupal_session() {
user_logout();
}
-/**
- * Checks whether the current request has been received over HTTPS or not.
- *
- * @return TRUE if the current request has been received over HTTPS, FALSE otherwise.
- *
- * @link https://www.drupal.org/node/313145
- */
-function _simplesamlphp_auth_is_https_request() {
- $is_https = isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on';
-
- if (!$is_https) {
- $reverse_proxy_proto_header = 'HTTP_X_FORWARDED_PROTO';
- $is_https = isset($_SERVER[$reverse_proxy_proto_header])
- && 'https' === strtolower($_SERVER[$reverse_proxy_proto_header]);
- }
- return $is_https;
-}
-
/****************************************************************************
* Public functions *********************************************************
****************************************************************************/