Skip to content

Commit

Permalink
Working around 'SubjectConfirmation was not found' issue due to inval…
Browse files Browse the repository at this point in the history
…id URL parsing, documented here: SAML-Toolkits/php-saml#175 (comment)
  • Loading branch information
patricknelson committed Aug 18, 2017
1 parent e3ddc42 commit 3532565
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion code/control/SAMLController.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ public function acs()
{ {
/** @var OneLogin_Saml2_Auth $auth */ /** @var OneLogin_Saml2_Auth $auth */
$auth = Injector::inst()->get('SAMLHelper')->getSAMLAuth(); $auth = Injector::inst()->get('SAMLHelper')->getSAMLAuth();

// Required to workaround a *possible* bug/regression caused by php-saml package: https://github.com/onelogin/php-saml/pull/175#issuecomment-323235699
$auth->getSettings()->setBaseURL('');

$auth->processResponse(); $auth->processResponse();


$error = $auth->getLastErrorReason(); $error = $auth->getLastErrorReason();
Expand All @@ -51,6 +55,7 @@ public function acs()
return $this->getRedirect(); return $this->getRedirect();
} }



$decodedNameId = base64_decode($auth->getNameId()); $decodedNameId = base64_decode($auth->getNameId());
// check that the NameID is a binary string (which signals that it is a guid // check that the NameID is a binary string (which signals that it is a guid
if (ctype_print($decodedNameId)) { if (ctype_print($decodedNameId)) {
Expand Down Expand Up @@ -97,7 +102,7 @@ public function acs()


$member->$field = $attributes[$claim][0]; $member->$field = $attributes[$claim][0];
} }

$member->SAMLSessionIndex = $auth->getSessionIndex(); $member->SAMLSessionIndex = $auth->getSessionIndex();


// This will trigger LDAP update through LDAPMemberExtension::memberLoggedIn. // This will trigger LDAP update through LDAPMemberExtension::memberLoggedIn.
Expand Down

0 comments on commit 3532565

Please sign in to comment.