You are here

function shib_auth_config in Shibboleth Authentication 6.4

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

Configuration handler

Stores default configuration values and returns the active configuration parameter or the list of configuration parameters when $list is set to TRUE.

Parameters

$variable: The name of the variable. The name of the variable.

$list: If set to TRUE, all configuration parameter names are returned. It's only intended to be used for debug purposes.

Return value

mixed The matching variable prefixed with shib_auth_, or the list of the module configuration variables, if $list is TRUE.

20 calls to shib_auth_config()
shib_auth_admin_advanced in ./shib_auth_forms.inc
Generate the administration form of the Shibboleth authentication module @returns HTML text of the administration form
shib_auth_admin_general in ./shib_auth_forms.inc
@file Drupal forms of the Shibboleth authentication module.
shib_auth_block in ./shib_auth.module
Generate the HTML text for the shib_auth login block
shib_auth_cancel_custom in ./shib_auth.module
Cancel button is pressed, redirect user to shib logout, and then to the page he came from / loginurl
shib_auth_consent_update in ./shib_auth.module
This function updates the accepted consent version number of the user to the current one

... See full list

File

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

Code

function shib_auth_config($variable, $list = FALSE) {

  //building an array with the available variables, and their default values
  static $var_store = array();
  if (empty($var_store)) {
    $var_store = array(
      'account_linking' => FALSE,
      'account_linking_text' => t('Link this account with another identity'),
      'auto_destroy_session' => FALSE,
      'debug_state' => FALSE,
      'define_username' => FALSE,
      'enable_custom_mail' => FALSE,
      'forceauthn' => FALSE,
      'force_https' => FALSE,
      'auto_destroy_session' => FALSE,
      'is_passive' => FALSE,
      'terms_accept' => FALSE,
      'debug_url' => '',
      'terms_ver' => '',
      'terms_url' => '/',
      'wayf_uri' => '/DS',
      'handler_protocol' => 'https',
      'handler_url' => '/Shibboleth.sso',
      'email_variable' => 'HTTP_SHIB_MAIL',
      'username_variable' => 'REMOTE_USER',
      'login_url' => '',
      'logout_url' => url('<front>'),
      'link_text' => t('Shibboleth Login'),
      'full_handler_url' => shib_auth_get_handler_base() . variable_get('shib_auth_wayf_uri', '/DS'),
      'full_logout_url' => shib_auth_get_handler_base() . '/Logout',
    );
  }
  if ($list) {
    return array_keys($var_store);
  }

  //check, if it exists in the array above, and get its value
  if (array_key_exists($variable, $var_store)) {
    return variable_get("shib_auth_{$variable}", $var_store[$variable]);
  }
  else {
    drupal_set_message(t("Function shib_auth_config(%variable) called but %variable doesn't exists.", array(
      '%variable' => $variable,
    )), 'error');
    return FALSE;
  }
}