diff --git a/CHANGELOG.md b/CHANGELOG.md index 56ed2db1a102ee50895ba9d21696b541a6d112e0..6d96ef8a493bd53791dbaa71a774165dd1af1153 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,13 @@ All notable changes to this project will be documented in this file. ## [Unreleased] +[Added] +- Added support for pass selected IdP from SP in AuthnContextClassRef attribute. + - It's required add this line into module_perun.php config file + <pre> + 'disco.removeAuthnContextClassRefPrefix' => 'urn:cesnet:proxyidp:', + </pre> + [Changed] - Social Idps are not shown when adding institution diff --git a/themes/bbmri/perun/disco-tpl.php b/themes/bbmri/perun/disco-tpl.php index ad900b971db98f1846ea5e2d21568cf388007f26..ca23f40b8e5f9e92f09086aca08ab510a53e4c7e 100644 --- a/themes/bbmri/perun/disco-tpl.php +++ b/themes/bbmri/perun/disco-tpl.php @@ -23,6 +23,11 @@ const WARNING_USER_CAN_CONTINUE = 'userCanContinue'; const WARNING_TITLE = 'title'; const WARNING_TEXT = 'text'; +const URN_CESNET_PROXYIDP_IDPENTITYID = "urn:cesnet:proxyidp:idpentityid:"; + +$authContextClassRef = null; +$idpEntityId = null; + $warningIsOn = false; $warningUserCanContinue = null; $warningTitle = null; @@ -63,6 +68,10 @@ if ($warningIsOn) { } } +if (isset($this->data['AuthnContextClassRef'])) { + $authContextClassRef = $this->data['AuthnContextClassRef']; +} + # Do not show social IdPs when using addInstitutionApp, show just header Add Institution if ($this->isAddInstitutionApp()) { // Translate title in header @@ -77,6 +86,18 @@ if ($this->isAddInstitutionApp()) { $this->includeAtTemplateBase('includes/header.php'); + if ($authContextClassRef != null) { + foreach ($authContextClassRef as $value) { + if (substr($value, 0, strlen(URN_CESNET_PROXYIDP_IDPENTITYID)) === URN_CESNET_PROXYIDP_IDPENTITYID) { + $idpEntityId = substr($value, strlen(URN_CESNET_PROXYIDP_IDPENTITYID), strlen($value)); + SimpleSAML\Logger::info("Redirecting to " . $idpEntityId); + $url = $this->getContinueUrl($idpEntityId); + SimpleSAML\Utils\HTTP::redirectTrustedURL($url); + exit; + } + } + } + if ($warningIsOn) { if ($warningUserCanContinue) { echo '<div class="alert alert-warning">';