You are here

function shib_auth_generate_login_url in Shibboleth Authentication 7.4

Same name and namespace in other branches
  1. 6.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_page_alter in ./shib_auth.module
Executes isPassive script.
_login_url_html in ./shib_auth.module
Generate the login block content if user not logged in.

File

./shib_auth.module, line 983
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 a URL to return from IdP.
  $url_to_return = (isset($_SERVER['HTTPS']) || shib_auth_config('force_https') && drupal_substr($sessioninitiator, 0, 5) == 'https' ? 'https' : 'http') . '://' . $_SERVER['SERVER_NAME'] . url('', array(
    'query' => $queries,
  ));
  if (preg_match('/\\?/', $sessioninitiator)) {
    $sep = '&';
  }
  return check_url($sessioninitiator . $sep . "target=" . urlencode($url_to_return) . $forceauthn);
}