48 $this->wrapper = $DIC->http()->wrapper();
51 $this->is_selection = $this->wrapper->post()->has(
'home_organization_selection');
52 $this->
lng = $DIC->isDependencyAvailable(
'language')
55 $this->wrapper->query()->has(
'lang')
56 ? $this->wrapper->query()->retrieve(
'lang', $DIC->refinery()->to()->string())
62 $idp_selection = $this->wrapper->post()->has(
'idp_selection')
63 ? $this->wrapper->post()->retrieve(
'idp_selection', $DIC->refinery()->to()->string())
65 if ($idp_selection !== null
66 && $idp_selection !==
'-' 67 && isset($this->idp_list[$idp_selection])
69 $this->is_valid_selection =
true;
70 $this->selected_idp = $idp_selection;
72 $this->is_valid_selection =
false;
88 $_saml_idp = $this->wrapper->cookie()->has(self::COOKIE_NAME_SAML_IDP)
89 ? $this->wrapper->cookie()->retrieve(
90 self::COOKIE_NAME_SAML_IDP,
91 $this->
refinery->kindlyTo()->string()
97 if ($idp_cookie !== [] && isset($this->idp_list[end($idp_cookie)])) {
98 $selectedIDP = end($idp_cookie);
100 <select name="idp_selection"> 101 <option value="-">' . $this->
lng->txt(
"shib_member_of") .
'</option>';
104 <select name="idp_selection"> 105 <option value="-" selected="selected">' . $this->
lng->txt(
"shib_member_of") .
'</option>';
108 foreach ($this->idp_list as $idp_id => $idp_data) {
109 if ($idp_id == $selectedIDP) {
110 $selectElement .=
'<option value="' . $idp_id .
'" selected="selected">' . $idp_data[0] .
'</option>';
112 $selectElement .=
'<option value="' . $idp_id .
'">' . $idp_data[0] .
'</option>';
116 return $selectElement .
' 126 $target = $this->wrapper->post()->has(
'il_target')
127 ? $this->wrapper->post()->retrieve(
'il_target', $this->
refinery->kindlyTo()->string())
129 $target = trim(ILIAS_HTTP_PATH,
'/') .
'/shib_login.php?target=' . $target;
131 if (isset($idp_data[1])) {
132 ilUtil::redirect($idp_data[1] .
'?providerId=' . urlencode($this->selected_idp) .
'&target=' 133 . urlencode($target));
137 ilUtil::redirect(
'/Shibboleth.sso?providerId=' . urlencode($this->selected_idp) .
'&target=' 138 . urlencode($target));
147 $_saml_idp = $this->wrapper->cookie()->retrieve(self::COOKIE_NAME_SAML_IDP, $this->
refinery->kindlyTo()->string());
150 setcookie(self::COOKIE_NAME_SAML_IDP, $this->
generateCookieValue($arr_idps), time() + (100 * 24 * 3600),
'/');
162 return $this->
lng->txt(
"shib_invalid_home_organization");
172 $idp_raw_list = explode(
"\n", $this->
settings->get(
"shib_idp_list"));
173 foreach ($idp_raw_list as $idp_line) {
174 $idp_data = explode(
',', $idp_line);
175 if (isset($idp_data[2])) {
176 $idp_list[trim($idp_data[0])] = array(trim($idp_data[1]), trim($idp_data[2]));
177 } elseif (isset($idp_data[1])) {
178 $idp_list[trim($idp_data[0])] = array(trim($idp_data[1]));
191 if (null === $value) {
194 $arr_cookie = explode(
' ', $value);
195 return array_map(
'base64_decode', $arr_cookie);
203 $arr_cookie = array_map(
'base64_encode', $arr_cookie);
204 return implode(
' ', $arr_cookie);
213 $arr_cookie[] = $value;
214 $arr_cookie = array_reverse($arr_cookie);
215 $arr_cookie = array_unique($arr_cookie);
216 return array_reverse($arr_cookie);
generateCookieValue(array $arr_cookie)
Generate the value that is stored in the cookie using the list of IDPs
redirect()
Redirects user to the local Shibboleth session initatiotor with already set GET arguments for the rig...
generateCookieArray(?string $value)
Generates an array of IDPs using the cookie value
appendCookieValue(string $value, array $arr_cookie)
Append a value to the array of IDPs
showNotice()
Show notice in case no IdP was selected
getIdplist()
Generate array of IdPs from ILIAS Shibboleth settings
ILIAS Refinery Factory $refinery
const COOKIE_NAME_SAML_IDP
static redirect(string $a_script)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setSAMLCookie()
Sets the standard SAML domain cookie that is also used to preselect the right entry on the local wayf...