2

I am trying to integrate our company's SSO into our Drupal installation. As a POC to see if it even works, I have a copy of the SimpleSAMLPhp Library located at /foo/bar/simplesamlphp. I configured my apache vhost and the SAML configs and that's all fine for now.

Per the instructions from Acquia on this page, I tried installing the drupal/simplesamlphp_auth module.

composer require drupal/simplesamlphp_auth

This installed the module and as a dependency, installed a second copy of the simplesamlphp library in vendor/simplesamlphp. Now it looks like the module simplesamlphp_auth is using the installation in vendor.

How do I configure this module to use the one I already placed in /foo/bar/simplesamlphp? There doesn't seem to be any options on the page /admin/config/people/simplesamlphp_auth.

I have configuration files that I would like to avoid copying over to the vendor directory after each deployment if possible, since that's not as secure as keeping the configs outside of the project altogether.

EDIT 1

Clarification on the configuration files: I need to define configuration files in /foo/bar/simplesamlphp/config in order for it to work. These configuration files are missing from vendor/simplesamlphp/config and without them the application encounters a fatal error. As stated in the Acquia document above, the library lives outside of vendor/ or docroot/ in their setup.

  • Whats in the vendor directory is the literal library, not the module. The module is an implementation that leverages the library classes located in vendor/. If you are using composer to get the module, you might as well be using it to manage dependencies as well. The modules composer.json file likely lists it as a dependency, so it gets fetched. "I have configuration files that I would like to avoid copying over to the vendor directory" - what does this mean? – Kevin Nov 13 '18 at 21:42
  • @Kevin The copy of the library in the vendor/ directory is missing configuration files, without them the site gives a WSOD. On deployment, I would have to take an additional step of copying the configurations I have /foo/bar/simplesamlphp/config to the one in vendor/simplesamlphp/config. It seems a little weird to modify the vendor directory outside of a composer command. – The Unknown Dev Nov 13 '18 at 21:50
  • 2
    Not exactly, this is something I am doing in my deployment script: - rm -rf $TRAVIS_BUILD_DIR/vendor/simplesamlphp/simplesamlphp/config and - ln -s $TRAVIS_BUILD_DIR/simplesamlphp/config $TRAVIS_BUILD_DIR/vendor/simplesamlphp/simplesamlphp/config .... this points the config folder to a location in your project outside of vendor. The library won't know the difference. – Kevin Nov 13 '18 at 21:56
  • 2
    I'm also doing something very similar to what Kevin's doing. Haven't found a better way to approach it yet – Clive Nov 13 '18 at 22:04
  • Yeah, I guess that'll have to do. It seems simple enough to script from a build tool like Jenkins. I just wish the instructions from Acquia were a little clearer on that. – The Unknown Dev Nov 14 '18 at 20:56
0

You can just create a symlink to your temporary SAML folder

ln -s /foo/bar/simplesamlphp ./simplesaml

In settings.php add next line:

$settings['simplesamlphp_dir'] = '/foo/bar/simplesamlphp';

In config.php file in your /simplesamlphp/config library add following settings:

// Load necessary environmental data
$ps = json_decode($_SERVER['PRESSFLOW_SETTINGS'], TRUE);
$host = $_SERVER['HTTP_HOST'];
$db = $ps['databases']['default']['default'];

// Define basic variables
$config = array (
   'baseurlpath' => 'https://'. $host .':443/simplesaml/', // SAML should always connect via 443
   'certdir' => 'cert/',
   'loggingdir' => '/files/private/log/',
   'datadir' => 'data/',
   'tempdir' => '/tmp/simplesaml',
   'store.type' => 'sql',
   'store.sql.dsn' => 'mysql:host='. $db['host'] .';port='. $db['port'] .';dbname='. $db['database'],
   'store.sql.username' => $db['username'],
   'store.sql.password' => $db['password'],
);

Now if you open your-site.com/simplesaml url in the browser, /foo/bar/simplesamlphp library will be used instead of vendor folder.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.