You are here

function simplesamlphp_auth_settings in simpleSAMLphp Authentication 7

Same name and namespace in other branches
  1. 6.3 simplesamlphp_auth.module \simplesamlphp_auth_settings()
  2. 6.2 simplesamlphp_auth.module \simplesamlphp_auth_settings()
  3. 7.2 simplesamlphp_auth.admin.inc \simplesamlphp_auth_settings()

Implements settings for the module.

1 string reference to 'simplesamlphp_auth_settings'
simplesamlphp_auth_menu in ./simplesamlphp_auth.module
Implements hook_menu().

File

./simplesamlphp_auth.module, line 373
simpleSAMLphp authentication module for Drupal.

Code

function simplesamlphp_auth_settings() {
  global $_simplesamlphp_auth_saml_version;
  if (!empty($_simplesamlphp_auth_saml_version)) {
    $ver = explode('.', $_simplesamlphp_auth_saml_version);
    if (!($ver[0] >= 1 && $ver[1] >= 5)) {
      drupal_set_message(t("Please upgrade SimpleSAMLphp. You are using %ssp_version", array(
        '%ssp_version' => $_simplesamlphp_auth_saml_version,
      )), 'warning');
    }
  }
  $form = array(
    'simplesamlphp_auth_activate' => array(
      '#type' => 'checkbox',
      '#title' => t('Activate authentication via SimpleSAMLphp'),
      '#default_value' => variable_get('simplesamlphp_auth_activate', FALSE),
      '#description' => t('Checking this box before configuring the module could lock you out of Drupal.'),
    ),
    'simplesamlphp_auth_installdir' => array(
      '#type' => 'textfield',
      '#title' => t('Installation directory (default: /var/simplesamlphp)'),
      '#default_value' => variable_get('simplesamlphp_auth_installdir', '/var/simplesamlphp'),
      '#description' => t('The base directory of simpleSAMLphp. Absolute path with no trailing slash.'),
    ),
    'simplesamlphp_auth_authsource' => array(
      '#type' => 'textfield',
      '#title' => t('Autenticaton source for this SP (default: default-sp)'),
      '#default_value' => variable_get('simplesamlphp_auth_authsource', 'default-sp'),
      '#description' => t('The name of the source to use from /var/simplesamlphp/config/authsources.php'),
    ),
    'simplesamlphp_auth_user_name' => array(
      '#type' => 'textfield',
      '#title' => t('Which attribute from simpleSAMLphp should be used as user\'s name'),
      '#default_value' => variable_get('simplesamlphp_auth_user_name', 'eduPersonPrincipalName'),
      '#description' => t('Example: <i>eduPersonPrincipalName</i> or <i>displayName</i><br />If the attribute is multivalued, the first value will be used.'),
      '#required' => TRUE,
    ),
    'simplesamlphp_auth_unique_id' => array(
      '#type' => 'textfield',
      '#title' => t('Which attribute from simpleSAMLphp should be used as unique identifier for the user'),
      '#default_value' => variable_get('simplesamlphp_auth_unique_id', 'eduPersonPrincipalName'),
      '#description' => t('Example: <i>eduPersonPrincipalName</i> or <i>eduPersonTargetedID</i><br />If the attribute is multivalued, the first value will be used.'),
      '#required' => TRUE,
    ),
    'simplesamlphp_auth_mailattr' => array(
      '#type' => 'textfield',
      '#title' => t('Which attribute from simpleSAMLphp should be used as user mail address'),
      '#default_value' => variable_get('simplesamlphp_auth_mailattr', 'mail'),
      '#description' => t('Example: <i>mail</i><br />If the user attribute is multivalued, the first value will be used.'),
    ),
    'simplesamlphp_auth_rolepopulation' => array(
      '#type' => 'textarea',
      '#title' => t('Automatic role population from simpleSAMLphp attributes'),
      '#default_value' => variable_get('simplesamlphp_auth_rolepopulation', ''),
      '#description' => t('A pipe separated list of rules.<br />Example: <i>roleid1:condition1|roleid2:contition2...</i> <br />For instance: <i>1:eduPersonPrincipalName,@=,uninett.no;affiliation,=,employee|2:mail,=,andreas@uninett.no</i>'),
    ),
    'simplesamlphp_auth_roleevaleverytime' => array(
      '#type' => 'checkbox',
      '#title' => t('Reevaluate roles every time the user logs in.'),
      '#default_value' => variable_get('simplesamlphp_auth_roleevaleverytime', 0),
      '#description' => t('NOTE: This means users could loose any roles that have been assigned manually in Drupal.'),
    ),
    'simplesamlphp_auth_forcehttps' => array(
      '#type' => 'checkbox',
      '#title' => t('Force https for login links'),
      '#default_value' => variable_get('simplesamlphp_auth_forcehttps', TRUE),
      '#description' => t('Should be enabled on production sites.'),
    ),
    'simplesamlphp_auth_registerusers' => array(
      '#type' => 'checkbox',
      '#title' => t('Register users'),
      '#default_value' => variable_get('simplesamlphp_auth_registerusers', TRUE),
      '#description' => t('Decides wether or not the module should create/register new users upon authentication.<br />NOTE: If unchecked each user must already have been provisioned a Drupal account before logging in. Otherwise they will receive a notice and be denied access.'),
    ),
    'simplesamlphp_auth_allowdefaultlogin' => array(
      '#type' => 'checkbox',
      '#title' => t('Allow authentication with local Drupal accounts'),
      '#default_value' => variable_get('simplesamlphp_auth_allowdefaultlogin', TRUE),
      '#description' => t('Check this box if you want to let people log in with local Drupal accounts (without using simpleSAMLphp). If you want to restrict this privilege to certain users you can enter the Drupal user IDs in the next field.'),
    ),
    'simplesamlphp_auth_allowdefaultloginusers' => array(
      '#type' => 'textfield',
      '#title' => t('Which users should be allowed to login with local accounts?'),
      '#default_value' => variable_get('simplesamlphp_auth_allowdefaultloginusers', ''),
      '#description' => t('Example: <i>1,2,3</i><br />A comma-separated list of user IDs that should be allowed to login without simpleSAMLphp.'),
    ),
  );
  return system_settings_form($form);
}