You are here

function shib_auth_get_handler_base in Shibboleth Authentication 6.4

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

Get Shibboleth handler base as an absolute URI (such as https://example.com/Shibboleth.sso)

Return value

handler base

1 call to shib_auth_get_handler_base()
shib_auth_config in ./shib_auth.module
Configuration handler

File

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

Code

function shib_auth_get_handler_base() {
  $handlerurl = variable_get('shib_auth_handler_url', '/Shibboleth.sso');
  $handlerprotocol = variable_get('shib_auth_handler_protocol', 'https');
  if (preg_match('#^http[s]{0,1}://#', $handlerurl)) {

    // If handlerurl is an absolute path
    return $handlerurl;
  }
  else {

    // Else, if the handlerurl is a relative path
    // If the URI doesn't start with slash then extend it
    if (drupal_substr($handlerurl, 0, 1) != '/') {
      $handlerurl = '/' . $handlerurl;
    }
    return $handlerprotocol . '://' . $_SERVER['HTTP_HOST'] . $handlerurl;
  }
}