You are here

function _drupalauth4ssp_get_simplesamlphp_config in DrupalAuth for SimpleSAMLphp 7

Same name and namespace in other branches
  1. 8 drupalauth4ssp.module \_drupalauth4ssp_get_simplesamlphp_config()

Returns the SimpleSAMLphp configuration.

2 calls to _drupalauth4ssp_get_simplesamlphp_config()
drupalauth4ssp_user_logout in ./drupalauth4ssp.module
Implements hook_user_logout().
_drupalauth4ssp_exec in ./drupalauth4ssp.module
Sets a special cookie for drupalauth4ssp.

File

./drupalauth4ssp.module, line 121
DrupalAuth For simpleSAMLphp module.

Code

function _drupalauth4ssp_get_simplesamlphp_config() {
  $config = NULL;
  if (!drupalauth4ssp_include_simplesamlphp_library()) {
    return;
  }
  $ssp_config = SimpleSAML_Configuration::getInstance();
  if (!is_object($ssp_config)) {
    return;
  }

  // Get the secretsalt.
  $config['secretsalt'] = $ssp_config
    ->getValue('secretsalt');

  // Get the baseurlpath.
  $config['baseurlpath'] = '/' . $ssp_config
    ->getBaseURL();
  unset($ssp_config);
  $ssp_authsources = SimpleSAML_Configuration::getConfig('authsources.php');
  $authsource = $ssp_authsources
    ->getValue(drupalauth4ssp_get_simplesamlphp_authsource());

  // get cookie_name from specified authsource
  $config['cookie_name'] = !empty($authsource['cookie_name']) ? $authsource['cookie_name'] : 'drupalauth4ssp';
  unset($ssp_authsources);

  // Make sure every configuration setting is present.
  foreach ($config as $val) {
    if (!strlen($val)) {
      return;
    }
  }
  return $config;
}