SAML SSO authentication doesn't work as SimpleSAMLphp generates non-existent AssertionConsumerServiceURL

Bug #1689685 reported by Yaju Mahida
16
This bug affects 3 people
Affects Status Importance Assigned to Milestone
Mahara
Confirmed
Undecided
Unassigned

Bug Description

Wrong AssertionConsumerServiceURL is genereated in SAML2-AuthRequest.

Mahara 16.10.3 and CentOS Linux release 7.2

Since 16.10.x release, the SimpleSAMLphp library is included as a managed dependency with the Mahara codebase.

We noticed that before sending an AuthRequest to an IDP, it generates wrong AssertionConsumerServiceURL behaving like it is hosted separately with Mahara which ends up in SSO failure.

In our case, it generates https://localhost/simplesaml/module.php/saml/sp/saml2-acs.php/default-sp
instead of https://localhost/auth/saml/sp/saml2-acs.php/default-sp.

We tracked down that it is generated using 'baseurlpath' => 'simplesaml/' defined in htdocs/auth/saml/config/config.php
and
$ar->setAssertionConsumerServiceURL(SimpleSAML_Module::getModuleURL('saml/sp/saml2-acs.php/' . $this->authId)); defined in htdocs/auth/saml/extlib/simplesamlphp/modules/saml/lib/Auth/Source/SP.php line 189.

As a workaround, we have hacked the SimpleSAMLphp library for generating correct AssertionConsumerServiceURL which solves this issue.

Yaju Mahida (yvm)
description: updated
Revision history for this message
Kristina Hoeppner (kris-hoeppner) wrote :

Hi Yaju,

Thanks for that info. Our 16.10 sites do work with the new SAML setup. We'll need to investigate this further.

Cheers
Kristina

Revision history for this message
shane (54an3) wrote :

@Yaju Can you share what changes you made to get it working?

Revision history for this message
Yaju Mahida (yvm) wrote :

Hi Shane,

We had to fix this on SimpleSAMLphp library (1.14.7) mahara/htdocs/auth/saml/extlib/simplesamlphp/modules/saml/lib/Auth/Source/SP.php line 189

From
$ar->setAssertionConsumerServiceURL(SimpleSAML_Module::getModuleURL('saml/sp/saml2-acs.php/' . $this->authId));
To
$ar->setAssertionConsumerServiceURL(get_config('wwwroot') . 'auth/saml/sp/saml2-acs.php/' . $this->authId);

We also had log out issues e.g. once a user is logged out from another application (part of SSO) Mahara should also log out but that wasn't the case. SAML session was terminated but not the Mahara session!

And for this issue we had to put $USERlogout(); to mahara/htdocs/auth/saml/sp/saml2-logout.php just before calling SAML logout page require('../extlib/simplesamlphp/modules/saml/www/sp/saml2-logout.php');

Are you experiencing similar issues?

Regards,
Yaju Mahida

Revision history for this message
Kristina Hoeppner (kris-hoeppner) wrote :

Tagged it to 17.10 so it stays on our radar to look at since we can't verify it immediately.

Changed in mahara:
milestone: none → 17.10.0
Revision history for this message
Robert Lyon (robertl-9) wrote :

Looking at the code I suspect its worked for some but not others is due to

public function startSSO($idp, array $state)

in

extlib/simplesamlphp/modules/saml/lib/Auth/Source/SP.php

where startSSO1 doesn't call the setAssertionConsumerServiceURL() but startSSO2 does

The problem with fixing this is we can't patch the files in extlib/simplesamlphp/ subdir as they are fetched/installed via the make ssphp in the core code

I'll have to check with our saml guru to see if we can workaround this via the saml config file

Revision history for this message
shane (54an3) wrote :

@Yaju Yeah, we're having a similar issue on 17.04. Mahara sends the user to our idp to login, but then the idp can't send the user back to mahara because the assertion consumer service URL (simplesaml/module.php/saml/sp/saml2-acs.php/default-sp) is not registered in the metadata.

Thanks for the workaround. I'm trying it out now.

Revision history for this message
shane (54an3) wrote :

@Yaju It works! Thanks again!

Revision history for this message
Kevin Rickis (rdx565) wrote :

@Yaju Thank you for the workaround. I hit the problem a couple of weeks ago and I wasn't sure where the problem was. Cheers.

Robert Lyon (robertl-9)
Changed in mahara:
milestone: 17.10.0 → 18.04.0
Revision history for this message
Kristina Hoeppner (kris-hoeppner) wrote :

Hi Yaju,

We made some improvements for Mahara 17.10 in that area, which also allow for ADFS to work. Can you please check the 17.10 code and see if that resolves your problem?

Thank you
Kristina

Changed in mahara:
status: New → Incomplete
milestone: 18.04.0 → none
Revision history for this message
Launchpad Janitor (janitor) wrote :

[Expired for Mahara because there has been no activity for 60 days.]

Changed in mahara:
status: Incomplete → Expired
Revision history for this message
Yaju Mahida (yvm) wrote :

Hi Kristina,

Just found your message now! We will be working on this next year so not able to confirm this now.

Noticed that this job's status has changed to expired!

Regards,
Yaju Mahida

Revision history for this message
Kristina Hoeppner (kris-hoeppner) wrote :

Hi Yaju,

I put it back onto "Incomplete". If you could test the latest 17.10 code please when you get the chance that would be great.

Cheers
Kristina

Changed in mahara:
status: Expired → Incomplete
Revision history for this message
Launchpad Janitor (janitor) wrote :

[Expired for Mahara because there has been no activity for 60 days.]

Changed in mahara:
status: Incomplete → Expired
Revision history for this message
Yaju Mahida (yvm) wrote :

Hi Kristina,

We are working on the Mahara 18.10.0 upgrade and this is still an issue. We are still using the workaround.

Please, re-open this issue.

Sorry, forgot to comment after the 17.10 testing.

Kind regards,
Yaju Mahida

Revision history for this message
Kristina Hoeppner (kris-hoeppner) wrote :

Hi Yaju. Thanks for checking. We'll need to look into it again as I suspect that we still can't change the actual SAML library and need to find a different way of dealing with this issue.

Changed in mahara:
status: Expired → Confirmed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.