You are here

function test_configuration in SAML SP 2.0 Single Sign On (SSO) - SAML Service Provider 7

Test configuration callback

1 call to test_configuration()
fix_attribute in ./miniorange_saml.module
1 string reference to 'test_configuration'
miniorange_saml_menu in ./miniorange_saml.module

File

./miniorange_saml.module, line 212
Module file for miniOrange SAML Module.

Code

function test_configuration() {
  $b_url = Utilities::miniorange_get_baseURL();
  if (!Utilities::miniorange_saml_is_sp_configured()) {
    echo '<div style="font-family:Calibri;padding:0 3%;">';
    echo '<div style="color: #a94442;background-color: #f2dede;padding: 15px;margin-bottom: 20px;text-align:center;border:1px solid #E6B3B2;font-size:18pt;"> ERROR</div>
      <div style="color: #a94442;font-size:14pt; margin-bottom:20px;"><p><strong>Error: </strong> Invalid SAML Request Status.</p>
      <p><strong>Reason</strong>: ' . 'Service Provider is not configured.' . '</p><br>
      </div>';
    exit;
  }
  $sendRelayState = "testValidate";
  $ssoUrl = variable_get("miniorange_saml_idp_login_url", "");
  $acsUrl = $b_url . "/?q=samlassertion";
  $issuer = Utilities::miniorange_get_issuer();
  $nameid_format = "urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified";
  $samlRequest = Utilities::createAuthnRequest($acsUrl, $issuer, $ssoUrl, $nameid_format, FALSE);
  $redirect = $ssoUrl;
  if (strpos($ssoUrl, '?') !== false) {
    $redirect .= '&';
  }
  else {
    $redirect .= '?';
  }
  $redirect .= 'SAMLRequest=' . $samlRequest . '&RelayState=' . urlencode($sendRelayState);
  drupal_goto($redirect);
  exit;
}