Co-authored by Brandon Goodwin and Sidhartha Sharma
To install the SimpleSAMLphp authentication module, run the following command:
composer require drupal/simplesamlphp_auth
Enable the SimpleSAMLphp Authentication module and add the External Authentication module as a dependency.
Create a symbolic link in the docroot to access SimpleSAMLphp from the web:
ln -s ../vendor/simplesamlphp/simplesamlphp/public docroot/simplesaml
In your project root, create a directory simplesamlphp_files.
mkdir -p simplesamlphp_files/config simplesamlphp_files/metadata
Copy the configuration template files from the vendor/simplesamlphp/simplesamlphp directory:
cp config.php.dist ../../../../simplesamlphp_files/config/config.phpcp authsources.php.dist ../../../../simplesamlphp_files/config/authsources.php
cp saml20-idp-remote.php.dist ../../../../simplesamlphp_files/metadata/saml20-idp-remote.php
Alternatively, you can use an environment variable to dictate where your configuration lives for simplesaml. For Cloud IDE, follow these steps: https://docs.acquia.com/acquia-cloud-platform/add-ons/ide/faq#section-how-can-i-set-a-custom-environment-variable-to-use-with-my-application
acli api:environments:variable-create
acli api:environments:variable-create
echo 'SetEnv SIMPLESAMLPHP_CONFIG_DIR "/home/ide/project/simplesamlphp_files/config"' > ~/configs/apache2/envvars.conf && acli ide:service-restart apache
Add the following to your composer.json within your 'post-install-cmd' section, located within scripts:
"post-install-cmd": [ "ln -f -s ../vendor/simplesamlphp/simplesamlphp/public ./docroot/simplesaml", "ln -f -s ../../../../simplesamlphp_files/config/authsources.php ./vendor/simplesamlphp/simplesamlphp/config/authsources.php", "ln -f -s ../../../../simplesamlphp_files/config/config.php ./vendor/simplesamlphp/simplesamlphp/config/config.php", "ln -f -s ../../../../simplesamlphp_files/metadata/saml20-idp-remote.php ./vendor/simplesamlphp/simplesamlphp/metadata/saml20-idp-remote.php" ]
This creates symlinks for your config and metadata files within the vendor simplesamlphp directory.
Include acquia config php in your config.php.
cat > simplesamlphp_files/config/config.php#Include Acquia specific functions and settingsinclude_once("acquia_config.php");EOF
if (file_exists('/var/www/site-php')) { require_once("/var/www/html/" . $_ENV['AH_SITE_NAME'] . "/simplesamlphp_files/config/acquia_config.php");}
In acquia_config.php, unsure of the ide section, modify the path for the cert to search the correct path. It appears that it is missing the html part in the path).
$config['certdir'] = "/var/www/html/{$_ENV['AH_SITE_GROUP']}.{$_ENV['AH_SITE_ENVIRONMENT']}/simplesamlphp_files/cert/"; $config['metadatadir'] = "/var/www/html/{$_ENV['AH_SITE_GROUP']}.{$_ENV['AH_SITE_ENVIRONMENT']}/simplesamlphp_files/metadata";
In your .htaccess, add the following snippet to prevent a permission denied error on the simplesaml path:
# Allow access to simplesaml pathsRewriteCond %{REQUEST_URI} !^/simplesaml
RewriteCond %{REQUEST_URI} !/core/modules/statistics/statistics.php$
RewriteRule "^(.+/.*|autoload)\.php($|/)" - [F]
$config['technicalcontact_name'] = "Test Name";$config['technicalcontact_email'] = "[email protected]";
$config['secretsalt'] = 'AddYourSaltStringHere';$config['auth.adminpassword'] = 'ChangeThisPlease';
LC_ALL=C tr -c -d '0123456789abcdefghijklmnopqrstuvwxyz' /dev/null;echoz50bvp9ipfy3vhtxsvzqy44jgc09zqqo
vendor/simplesamlphp/simplesamlphp/bin/pwgen.php
Notes: Depending on where you are setting this up (Acquia Cloud or Local), you may need to change the tempdir or loggingdir to an existing path.
array( // The default is to use core:AdminPassword, but it can be replaced with // any authentication source. 'core:AdminPassword', ), 'default-sp' => array( 'saml:SP', // The entityID is the entityID of the SP that the IdP is expecting. // This value must be exactly what the IdP is expecting. If the // entityID is not set, it defaults to the URL of the SP's metadata. // Don't declare an entityID for Site Factory. 'entityID' => 'https://' . $_SERVER['HTTP_HOST'] . '/simplesaml' . '/', // If the IdP requires the SP to hold a certificate, the location // of the self-signed certificate. // If you need to generate a SHA256 cert, see // https://gist.github.com/guitarte/5745b94c6883eaddabfea68887ba6ee6 'certificate' => "../cert/saml.crt", 'privatekey' => "../cert/saml.pem", 'redirect.sign' => TRUE, 'redirect.validate' => TRUE, // The entityID of the IdP. // This is included in the metadata from the IdP. 'idp' => 'idp entityID goes here', // NameIDFormat is included in the metadata from the IdP 'NameIDFormat' => 'urn:oasis:names:tc:SAML:2.0:nameid-format:transient', // If the IdP does not pass any attributes, but provides a NameID in // the authentication response, we can filter and add the value as an // attribute. // See https://simplesamlphp.org/docs/stable/saml:nameidattribute 'authproc' => array( 20 => array( 'class' => 'saml:NameIDAttribute', 'format' => '%V', ), ), // The RelayState parameter needs to be set if SSL is terminated // upstream. If you see the SAML response come back with // https://example.com:80/saml_login, you likely need to set this. // See https://github.com/simplesamlphp/simplesamlphp/issues/420 'RelayState' => 'https://' . $_SERVER['HTTP_HOST'] . '/saml_login', // If working with ADFS, Microsoft may soon only allow SHA256 certs. // You must specify signature.algorithm as SHA256. // Defaults to SHA1 (http://www.w3.org/2000/09/xmldsig#rsa-sha1) // See https://docs.microsoft.com/en-us/security/trusted-root/program-requirements // 'signature.algorithm' => 'http://www.w3.org/2001/04/xmldsig-more#rsa-sha256', ),);
If your IdP requires an SSL cert for authentication, create a cert directory under the simplesamlphp_files directory and place both the cert and private key in that location:
Create the cert directory:
mkdir simplesamlphp_files/cert
openssl req -newkey rsa:3072 -new -x509 -days 3652 -nodes -out saml.crt -keyout saml.pem
Given the metadata XML file provided by your IDP, navigate to /simplesaml/module.php/admin/federation/metadata-converter.
Press parse. It outputs the proper input for saml20-idp-remote file.
https://your-domain.com/simplesaml/admin
to access the SimpleSAMLphp admin interface. You must see the SimpleSAMLphp dashboard if everything is configured correctly.simplesamlphp_files
and its contents. All files should be readable by the web server.config.php
and authsources.php
for syntax errors or incorrect paths.If this content did not answer your questions, try searching or contacting our support team for further assistance.
Fri Sep 12 2025 06:20:52 GMT+0000 (Coordinated Universal Time)