You are here

function saml_sp__admin_config_validate in SAML Service Provider 7.2

Same name and namespace in other branches
  1. 7.8 saml_sp.admin.inc \saml_sp__admin_config_validate()
  2. 7.3 saml_sp.admin.inc \saml_sp__admin_config_validate()

File

./saml_sp.admin.inc, line 608
Admin pages for the SAML Service Provider module.

Code

function saml_sp__admin_config_validate(&$form, &$form_state) {

  // check the saml_sp__sign_metadata status
  if (isset($form_state['values']['saml_sp__sign_metadata']) && !empty($form_state['values']['saml_sp__sign_metadata'])) {

    // certificate file
    if (empty($form_state['values']['saml_sp__cert_location'])) {
      form_set_error('saml_sp__cert_location', 'The Certificate Location must be provided.');
    }
    if (!is_file($form_state['values']['saml_sp__cert_location'])) {
      form_set_error('saml_sp__cert_location', 'The Certificate file does not exist.');
    }

    // key file
    if (empty($form_state['values']['saml_sp__key_location'])) {
      form_set_error('saml_sp__cert_location', 'The Certificate Location must be provided.');
    }
    if (!is_file($form_state['values']['saml_sp__key_location'])) {
      form_set_error('saml_sp__cert_location', 'The Certificate file does not exist.');
    }
  }
}