You are here

function _drupalauth4ssp_get_simplesamlphp_config in DrupalAuth for SimpleSAMLphp 8

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

Returns the SimpleSAMLphp configuration.

@todo Convert to service?

2 calls to _drupalauth4ssp_get_simplesamlphp_config()
drupalauth4ssp_set_user_cookie in ./drupalauth4ssp.module
Set auth cookie for the account.
drupalauth4ssp_user_logout in ./drupalauth4ssp.module
Implements hook_user_logout().

File

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

Code

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

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

  // Get the baseurlpath.
  $config['baseurlpath'] = $ssp_config
    ->getBasePath();
  unset($ssp_config);
  $ssp_authsources = Configuration::getConfig('authsources.php');
  $authsource = $ssp_authsources
    ->getValue(\Drupal::service('config.factory')
    ->get('drupalauth4ssp.settings')
    ->get('authsource'));

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