Jump to content
TNG Community

Wiki Integration and SimpleSamL authsource code


PapaG

Recommended Posts

Hi Everyone!

I hope this is in the right place!

I'm following the instructions for using SimpleSAML as a method to create single sign-on between TNG and Media WiKi. So far, I have everything working including testing the SSO "admin" source. However, I can not get the "authsources" code that is mentioned on the WiKi integration page Single sign-on integration with SimpleSAMLphp - TNG_Wiki (lythgoes.net) to work - whether I modify the code or not, I get the same error:

SimpleSAML\Error\ConfigurationError: The configuration (config/authsources.php) is invalid: syntax error, unexpected ';', expecting ')'

I am using PHP 7.2 and my suspicions are that something has changed with the upgrades in PHP and there must be something that needs to be changed or is missing in order to make the code work. I am not a code writer but I have been somewhat successful getting some code to work. Unfortunately, this one I am afraid I can not. So, any PHP code writers out there that want to take a look at this and let me know what I'm missing? the code is below.

Many thanks!

Dave 

Authsource code:

$config = array(
 'tngidpauth' => array(
  'tngextauth:External',
        'dsn'       => 'mysql:host=localhost;dbname=yourdatabasename',
        'username'  => 'yourdatabaseusername',
        'password'  => 'yourdatabasepassword',
        'tngpath'   => '/home/example/public_html/tng/',    // the TNG path from (and including) the 'home' directory; ends with a slash.
        'loginpage' => 'http://example.com/tng/login.php',  // full URL to TNG's login page.
        'logoutpage'=> 'http://example.com/tng/logout.php', // full URL to TNG's logout page.
 ),
    /* Other authentication sources follow. */

Link to comment
Share on other sites

Dave,

That wiki page indicates

Quote

The methodology should be considered an 'ALPHA RELEASE'.

I do not recall seeing the user on this forum nor on the TNG user2list, but then I might have missed it.

If you find someone who understands MediaWiki, I could use help trying to upgrade the TNG Wiki to MediaWiki 1.35

Link to comment
Share on other sites

Thanks for the quick response!

Ken: I'm not sure how much help I can be with the upgrade. It appears there are issues with Media WiKi and TNG with the newer versions of PHP. I can't remember specifically but generally, MediaWiKi 1.35 wants to use the newest version of PHP (7.4 I believe) and it won't even install with earlier versions. I tried to upgrade to 7.4 but noticed weird things happening with THG so I dropped back to 7.2. It could have been me but I simply decided to go with an older version of Media Wiki (and stay at PHP 7.2) and everything works fine following the instructions on the MediaWiki page. Where I ran into trouble is trying to get SimpleSAML to work. I am very uncomfortable with anyone other than family accessing our genealogy stuff so I want everything password protected. I hate the idea of recreating IDs and PWs for every approved user of the site. I suspect I may be in the same jam trying to get things to work with differing versions of PHP.

Erik: Many thinks for the suggestion. However, I'm afraid it didn't work. I tried taking out the comma you suggested but no change. I also took out the one after it thinking that might be what you meant instead and got the following:

SimpleSAML\Error\ConfigurationError: The configuration (config/authsources.php) is invalid: syntax error, unexpected '$config' (T_VARIABLE), expecting ')'

I'm hoping it might be a clue but either way, any other suggestions are always welcome!

Dave

Link to comment
Share on other sites

Okay, just an update:

I monkeyed with the code and I believe I'm getting somewhere. I have a new error:

Exception: Could not resolve 'tngextauth:External': no class named 'SimpleSAML\Module\tngextauth\Auth\Source\External' or 'sspmod_tngextauth_Auth_Source_External'.

Which seems to indicate that there is something wrong with the "Class" definition. Either that or its looking in the wrong place. The class definition (I believe)  is defined in the "external.php" file located in the "modules" section of SimpleSAMLPHP. I tried modifying the "test" version of a simple password authentication script and was successful. So I believe I might be on to something. The code that is supposed to define the "External" class is as follows:

class sspmod_tngextauth_Auth_Source_External extends SimpleSAML_Auth_Source {
    /* The database DSN. */
    private $dsn;
    /* The database username & password. */
    private $username;
    private $password;
    /* The path to the TNG folder. */
    private $tngpath;
    /* The paths to the TNG Log-in and Log-out pages. */
    private $loginpage;
    private $logoutpage;

The database source, login logout pages etc. I believe are defined in the file (the code in my original post). I'm thinking that now, the issue is in the first line of this snippet but I am really at a loss as to what it should look like.

Any thoughts or suggestions are greatly appreciated!

Dave

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...