You are here

function shib_auth_generate_login_url in Shibboleth Authentication 6.4

Same name and namespace in other branches
  1. 7.4 shib_auth.module \shib_auth_generate_login_url()

Generates shibboleth login url based on configuration

3 calls to shib_auth_generate_login_url()
shib_auth_account_link in ./shib_auth_forms.inc
This function manages account linking
shib_auth_footer in ./shib_auth.module
This footer part executes isPassive script, if the option was checked on the configuration page
_login_url_html in ./shib_auth.module
Generate the login block content if user not logged in

File

./shib_auth.module, line 797
Drupal Shibboleth authentication module.

Code

function shib_auth_generate_login_url() {
  $queries = $_GET;
  $sep = "?";
  $sessioninitiator = shib_auth_get_redirect_base(shib_auth_config('full_handler_url'));
  $forceauthn = '';

  //append forceAuthN variable to the login string
  if (shib_auth_config('forceauthn')) {
    $forceauthn = '&forceAuthn=1';
  }
  $queries['q'] = 'shib_login/' . $queries['q'];

  //generate the currently viewed url to pass as an url to return from IdP

  //TODO refactor:
  $url_to_return = (isset($_SERVER['HTTPS']) || shib_auth_config('force_https') && drupal_substr($sessioninitiator, 0, 5) == 'https' ? 'https' : 'http') . '://' . $_SERVER['HTTP_HOST'] . url('', array(
    'query' => $queries,
  ));
  if (preg_match('/\\?/', $sessioninitiator)) {
    $sep = '&';
  }
  return "{$sessioninitiator}" . $sep . "target=" . urlencode($url_to_return) . $forceauthn;
}