You are here

function samlauth_get_config in SAML Authentication 7

Same name and namespace in other branches
  1. 8 samlauth.module \samlauth_get_config()

Returns configuration array for SAML SP.

Return value

array

2 calls to samlauth_get_config()
samlauth_configure_form in ./samlauth.admin.inc
Form builder for samlauth_configure_form.
samlauth_get_saml2_auth in ./samlauth.module
Get an instance of the SAML Auth class.

File

./samlauth.module, line 156
Provides SAML authentication capabilities.

Code

function samlauth_get_config() {
  $config = array(
    'baseurl' => url('saml', array(
      'absolute' => TRUE,
    )) . '/',
    'strict' => (bool) variable_get('samlauth_security_strict'),
    'sp' => array(
      'entityId' => variable_get('samlauth_sp_entity_id'),
      'assertionConsumerService' => array(
        'url' => url('saml/acs', array(
          'absolute' => TRUE,
        )),
      ),
      'singleLogoutService' => array(
        'url' => url('saml/sls', array(
          'absolute' => TRUE,
        )),
      ),
      'NameIDFormat' => variable_get('samlauth_sp_name_id_format'),
      'x509cert' => variable_get('samlauth_sp_x509_certificate'),
      'privateKey' => variable_get('samlauth_sp_private_key'),
    ),
    'idp' => array(
      'entityId' => variable_get('samlauth_idp_entity_id'),
      'singleSignOnService' => array(
        'url' => variable_get('samlauth_idp_single_sign_on_service'),
      ),
      'singleLogoutService' => array(
        'url' => variable_get('samlauth_idp_single_log_out_service'),
      ),
      'x509cert' => variable_get('samlauth_idp_x509_certificate'),
    ),
    'security' => array(
      'authnRequestsSigned' => (bool) variable_get('samlauth_security_authn_requests_sign'),
      'logoutRequestSigned' => (bool) variable_get('samlauth_logout_requests_sign'),
      'logoutResponseSigned' => (bool) variable_get('samlauth_logout_responses_sign'),
      'wantMessagesSigned' => (bool) variable_get('samlauth_security_messages_sign'),
      'wantAssertionsSigned' => (bool) variable_get('samlauth_security_assertions_signed'),
      'wantAssertionsEncrypted' => (bool) variable_get('samlauth_security_assertions_encrypted'),
      'wantNameId' => (bool) variable_get('samlauth_want_name_id', TRUE),
      'requestedAuthnContext' => (bool) variable_get('samlauth_security_request_authn_context'),
      'lowercaseUrlencoding' => (bool) variable_get('samlauth_lowercase_url_encoding'),
    ),
  );

  // Passing NULL for signatureAlgorithm would be OK, but not ''.
  $sig_alg = variable_get('samlauth_security_security_signature_algorithm');
  if ($sig_alg) {
    $config['security']['signatureAlgorithm'] = $sig_alg;
  }
  return $config;
}