function shib_auth_get_handler_base in Shibboleth Authentication 7.4
Same name and namespace in other branches
- 6.4 shib_auth.module \shib_auth_get_handler_base()
 
Returns Shibboleth handler base as an absolute URI.
Get Shibboleth handler base as an absolute URI (such as https://example.com/Shibboleth.sso).
Return value
string Handler base in string.
1 call to shib_auth_get_handler_base()
- shib_auth_config in ./
shib_auth.module  - Configuration handler.
 
File
- ./
shib_auth.module, line 928  - 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['SERVER_NAME'] . $handlerurl;
  }
}