Exception: Could not resolve 'drupalauth:External': The class 'SimpleSAML\Module\drupalauth\Auth\Source\External' isn't a subclass of '\SimpleSAML\Auth\Source'

Created on 9 February 2024, 5 months ago
Updated 5 April 2024, 3 months ago

I've just upgraded to simplesamlphp version 2.1 for Drupal 10/Symfony 6 and there are some changes required to get this working, notably the old method of placing an 'enable' file at /vendor/simplesamlphp/simplesamlphp/modules/drupalauth will no longer work. All modules must now be explicitly declared in the config/config.php file like so:

  'module.enable' => [
    'core' => null,
    'saml' => true,
    'drupalauth' => true,
  ],

But even with that resolved, I am now getting this error:

Exception: Could not resolve 'drupalauth:External': The class 'SimpleSAML\Module\drupalauth\Auth\Source\External' isn't a subclass of '\SimpleSAML\Auth\Source'

🐛 Bug report
Status

Needs review

Version

2.0

Component

Code

Created by

🇺🇸United States brooke_heaton

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @brooke_heaton
  • Assigned to chetan 11
  • 🇺🇸United States brooke_heaton

    I should note that the new requiresments of the module.enable config makes the current README and Drupal\saml_idp\Install::postInstall obsolete. The config-dist should probably include an example config.php file as well.

  • Issue was unassigned.
  • Assigned to halth
  • 🇧🇷Brazil halth Brazil

    I'm having this same issue on a client project. I'll try to resolve this today.

  • Merge request !12Add changes from halth to 2.0 branch. → (Open) created by brooke_heaton
  • 🇧🇷Brazil halth Brazil

    Just a quick status update that I'm still working on this. Should be opening a new MR in the next couple of days.

  • Status changed to Needs review 4 months ago
  • 🇧🇷Brazil halth Brazil

    Just applied the latest set of changes on top of MR!12.

    Appreciate the community's effort in reviewing it.

    Also, I believe this module will need a rewrite for full SimpleSAMLphp:2.1 compatibility, now that they support namespaced classes.

    I don't know SimpleSAMLphp fully and I'm uncertain if "pattern named functions" (like sspmod_drupalauth_Auth_Source_External) are still supported.

    I also ran by the https://www.drupal.org/project/drupalauth4ssp module, which relies on the `drupalauth/simplesamlphp-module-drupalauth` composer project.

    Even though it's not a 1 to 1 replacement (especially on the approach to set user attributes, which impose a hard rule with little-to-no customization), it seems like a more active project.

    As the maintainer of this module is looking for support/new maintainers, wouldn't it be case the join efforts with the fellows from drupalauth4ssp?

    What are your thoughts?

    Thanks,
    Heitor.

  • 🇺🇸United States brooke_heaton

    FWIW since the future of this module is undetermined, I have implemented drupalauth4ssp and so far it is working pretty well, however it is lacking some of the features of saml_idp, namely the implementation of a alter hook to manipulate the SimpleSAML 'attributes' in an assertion. But it does seem to have a mechanism to define attributes. I am still investigating. Thanks for your owrk on this @halth.

  • 🇺🇸United States bradjones1 Digital Nomad Life

    I haven't touched SAML in ages though I am still active in the auth space writ-large. I still don't really love how this module works under the hood but if people I know/respect are using this, I'm happy to pass the torch or give some thoughts or, whatever.

    Brooke, do you want to be a maintainer?

  • 🇬🇧United Kingdom Rob230

    Did anyone actually get this to work?

    I'm trying the merge request. First of all, it does still need a drupalauth directory creating in vendor/simplesamlphp/simplesamlphp/modules, because the getModules() code scans that directory for modules, and it will say the drupalauth module doesn't exist without it.

    But I get this error:

    Caused by: Exception: Could not resolve 'drupalauth:External': The class 'SimpleSAML\Module\drupalauth\Auth\Source\External' isn't a subclass of '\SimpleSAML\Auth\Source'.

    I don't exactly understand what this code in vendor/simplesamlphp/simplesamlphp/src/SimpleSAML/Module::resolveClass() is doing, but it seems like the www/modules/contrib/saml_idp/src/Auth/Source/External class is not being found, because it is a subclass of \SimpleSAML\Auth\Source.

  • 🇬🇧United Kingdom Rob230

    I managed to get it working with these changes:

    1. Put a blank file at vendor/simplesamlphp/simplesamlphp/modules/drupalauth

    2. Apply the attached patch on top of MR12 (I have not added to your merge requests because I don't understand why it was done that way or how you got it working).

    3. Update autoload section to composer.json as follows:

    "autoload": {
        "psr-4": {
            "SimpleSAML\\Module\\drupalauth\\Auth\\": "www/modules/contrib/saml_idp/src/Auth/"
        },
        "classmap": [
            "scripts/composer/ScriptHandler.php",
            "www/modules/contrib/saml_idp/src/Auth/"
        ]
    },
  • 🇬🇧United Kingdom Rob230

    The patch mentioned in previous comment.

Production build 0.69.0 2024