skip to Main Content

I want to create a custom authentication module for my SimpleSamlPHP installation, but each time I try to test the module I get this error:

SimpleSAMLErrorError: UNHANDLEDEXCEPTION

Backtrace:
1 www/_include.php:17 (SimpleSAML_exception_handler)
0 [builtin] (N/A)
Caused by: Exception: Could not resolve 'mymodule:MyAuth': no class named 'SimpleSAMLModulemymoduleAuthSourceMyAuth' or 'sspmod_mymodule_Auth_Source_MyAuth'.
Backtrace:
7 lib/SimpleSAML/Module.php:437 (SimpleSAMLModule::resolveClass)
6 lib/SimpleSAML/Auth/Source.php:336 (SimpleSAMLAuthSource::parseAuthSource)
5 lib/SimpleSAML/Auth/Source.php:382 (SimpleSAMLAuthSource::getById)
4 lib/SimpleSAML/Auth/Simple.php:66 (SimpleSAMLAuthSimple::getAuthSource)
3 lib/SimpleSAML/Auth/Simple.php:166 (SimpleSAMLAuthSimple::login)
2 modules/core/www/authenticate.php:38 (require)
1 lib/SimpleSAML/Module.php:254 (SimpleSAMLModule::process)
0 www/module.php:10 (N/A)

I have followed SimpleSAML’s tutorial down to step four where I need to test the module. In my config.php file I am enabling the module like so:

'myauth' => [
    'mymodule:MyAuth'
],

If I change the module name in the config file to one of SimpleSaml’s pre-installed modules eg.

'myauth' => [
    'sqlauth:MyAuth'
],

then it works just fine. In fact, if I change the name of my custom module folder to be the same as one of the pre-installed modules and change the namespace path in my module file to reflect that, my module code works just fine. I believe that it has something to do with the namespace in my module file, but I cannot figure it out. I am using SimpleSaml version 1.18.5 and php version 7.2.24 on Ubuntu 18.04.

3

Answers


  1. Just ran into this myself. The documentation is unclear, but you need to add an "enable" file at the root of your module folder as suggested by Patrick in the comments. It can be a completely empty file just with the name "enable" and nothing in it. On the command line in a Linux/Unix system, you could do this:

    touch enable
    
    Login or Signup to reply.
  2. I came across this issue myself; I spent hours on this issue…

    To fix your issue; depending on your version of SimpleSAMLphp (as of the latest), the ‘default_enable’ or ‘enable’ file in the root of your module will not work. You have to enable your module manually, by adding the following to the config.php file:

    <?php
    $config = [
      module.enable = [
        'core' => null,
        'saml' => true,
        'customAuth' => true,
      ],
    ],
    

    This will make your customAuth module work.

    For some reason, psr4 autoloaded modules work out-of-the-box (the modules you install using composer etc.).

    If you can, avoid simpleSAMLphp and go for something more serious.

    Login or Signup to reply.
  3. go to your config.php file and enable the module as mark said

    <?php
    $config = [
    module.enable = [
    'core' => true,
    'saml' => true,
    'customauth' => true,
    'sqlauth' => true,
    ],
    ],
    

    just add sqlauth= true with mark‘s answer. I had the same issue, I got help from mark’s answer and just added this line and my issue was solved. Thanks Mark.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search