Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot access SimpleSAML from Vendor #9

Open
cmcintosh opened this issue Dec 19, 2018 · 2 comments
Open

Cannot access SimpleSAML from Vendor #9

cmcintosh opened this issue Dec 19, 2018 · 2 comments

Comments

@cmcintosh
Copy link

Running into a couple of challenges. Seems like there has been a update to Drupal 8 that prevents accessing things in the vendor folder. I have done a ln -s from vendor/simplesamlphp/simplesamlphp/www to DRUPAL_ROOT/simplesaml but get a Apache 403 error. I have checked htaccess files and other things, but no dice.

Moving SimpleSAMLPHP out of the vendor folder to anywhere else allows me to access SimpleSaml's interface. However, the DrupalExternal module for SimpleSAML no longer works because it does not have a working connection to Drupal's code base.

Im working on some solutions for this, one of them is including Drupal's autoloading file at the top of the External.php file. Will use this issue to document my progress as I go.

@PhilippVerpoort
Copy link

I've got the same problem. Have you had any more luck?

@robme
Copy link

robme commented Apr 1, 2019

I would be interested in a fix for this as well. As a temporary solution I just hardcoded the location of Drupal root using a patch, but this is obviously not ideal.

The patch:

diff --git a/src/Auth/Source/External.php b/src/Auth/Source/External.php
index 1990a78..c0b2742 100644
--- a/src/Auth/Source/External.php
+++ b/src/Auth/Source/External.php
@@ -45,14 +45,9 @@ class sspmod_drupalauth_Auth_Source_External extends SimpleSAML_Auth_Source {
       $this->container = \Drupal::getContainer();
     }
     catch (Exception $e) {
-      $finder = new \DrupalFinder\DrupalFinder();
-      if ($finder->locateRoot(getcwd())) {
-        $classloader = require $finder->getVendorDir() . '/autoload.php';
-      }
-      else {
-        throw new Exception('Could not find Drupal root.');
-      }
-      DrupalKernel::bootEnvironment($finder->getDrupalRoot());
+      $root_dir = '/var/www/full/path';
+      $classloader = require $root_dir . '/vendor/autoload.php';
+      DrupalKernel::bootEnvironment($root_dir . '/www');
       $request = Request::createFromGlobals();
       $request->server->set('SCRIPT_FILENAME', '/index.php');
       $this->kernel = DrupalKernel::createFromRequest($request, $classloader, 'prod');

And set $root_dir and change '/www' to '/docroot' or whatever the directory containing Drupal is called before applying the patch in composer.json.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants