You are here

function samlauth_get_config in SAML Authentication 8

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

Returns configuration array for SAML SP.

4 calls to samlauth_get_config()
SamlauthConfigureForm::buildForm in src/Form/SamlauthConfigureForm.php
Form constructor.
SamlController::login in src/Controller/SamlController.php
Redirect to the Login service on the IDP.
SamlController::logout in src/Controller/SamlController.php
Redirect to the SLS service on the IDP.
SamlService::create in src/SamlService.php
Factory method for dependency injection container.

File

./samlauth.module, line 30
Contains samlauth.module.

Code

function samlauth_get_config() {
  $config = \Drupal::config('samlauth.authentication');
  return array(
    'sp' => array(
      'entityId' => $config
        ->get('sp_entity_id'),
      'assertionConsumerService' => array(
        'url' => \Drupal::urlGenerator()
          ->generateFromRoute('samlauth.saml_controller_acs', array(), array(
          'absolute' => TRUE,
        )),
      ),
      'singleLogoutService' => array(
        'url' => \Drupal::urlGenerator()
          ->generateFromRoute('samlauth.saml_controller_sls', array(), array(
          'absolute' => TRUE,
        )),
      ),
      'NameIDFormat' => $config
        ->get('sp_name_id_format'),
      'x509cert' => $config
        ->get('sp_x509_certificate'),
      'privateKey' => $config
        ->get('sp_private_key'),
    ),
    'idp' => array(
      'entityId' => $config
        ->get('idp_entity_id'),
      'singleSignOnService' => array(
        'url' => $config
          ->get('idp_single_sign_on_service'),
      ),
      'singleLogoutService' => array(
        'url' => $config
          ->get('idp_single_log_out_service'),
      ),
      'x509cert' => $config
        ->get('idp_x509_certificate'),
    ),
    'security' => array(
      'authnRequestsSigned' => $config
        ->get('security_authn_requests_sign') ? TRUE : FALSE,
      'wantMessagesSigned' => $config
        ->get('security_messages_sign') ? TRUE : FALSE,
      'wantNameIdSigned' => $config
        ->get('security_name_id_sign') ? TRUE : FALSE,
      'requestedAuthnContext' => $config
        ->get('security_request_authn_context') ? TRUE : FALSE,
    ),
  );
}