49 $this->wrapper =
$DIC->http()->wrapper();
52 $this->is_selection = $this->wrapper->post()->has(
'home_organization_selection');
53 $this->
lng = $DIC->isDependencyAvailable(
'language')
56 $this->wrapper->query()->has(
'lang')
57 ? $this->wrapper->query()->retrieve(
'lang',
$DIC->refinery()->to()->string())
63 $idp_selection = $this->wrapper->post()->has(
'idp_selection')
64 ? $this->wrapper->post()->retrieve(
'idp_selection',
$DIC->refinery()->to()->string())
66 if ($idp_selection !==
null
67 && $idp_selection !==
'-'
68 && isset($this->idp_list[$idp_selection])
70 $this->is_valid_selection =
true;
71 $this->selected_idp = $idp_selection;
73 $this->is_valid_selection =
false;
89 $saml_idp = $this->wrapper->cookie()->has(self::COOKIE_NAME_SAML_IDP)
90 ? $this->wrapper->cookie()->retrieve(
91 self::COOKIE_NAME_SAML_IDP,
92 $this->
refinery->kindlyTo()->string()
98 if ($idp_cookie !== [] && isset($this->idp_list[end($idp_cookie)])) {
101 <select name="idp_selection">
102 <option value="-">' . $this->
lng->txt(
"shib_member_of") .
'</option>';
105 <select name="idp_selection">
106 <option value="-" selected="selected">' . $this->
lng->txt(
"shib_member_of") .
'</option>';
109 foreach ($this->idp_list as $idp_id => $idp_data) {
111 $select_element .=
'<option value="' . $idp_id .
'" selected="selected">' . $idp_data[0] .
'</option>';
113 $select_element .=
'<option value="' . $idp_id .
'">' . $idp_data[0] .
'</option>';
117 return $select_element .
'
127 $target = $this->wrapper->post()->has(
'il_target')
128 ? $this->wrapper->post()->retrieve(
'il_target', $this->
refinery->kindlyTo()->string())
130 $target = trim(ILIAS_HTTP_PATH,
'/') .
'/shib_login.php?target=' . $target;
132 if (isset($idp_data[1])) {
133 ilUtil::redirect($idp_data[1] .
'?providerId=' . urlencode($this->selected_idp) .
'&target='
134 . urlencode($target));
138 ilUtil::redirect(
'/Shibboleth.sso?providerId=' . urlencode($this->selected_idp) .
'&target='
139 . urlencode($target));
148 $_saml_idp = $this->wrapper->cookie()->retrieve(self::COOKIE_NAME_SAML_IDP, $this->
refinery->kindlyTo()->string());
151 setcookie(self::COOKIE_NAME_SAML_IDP, $this->
generateCookieValue($arr_idps), [
'expires' => time() + (100 * 24 * 3600),
'path' =>
'/']);
163 return $this->
lng->txt(
"shib_invalid_home_organization");
173 $idp_raw_list = explode(
"\n", (
string) $this->
settings->get(
"shib_idp_list"));
174 foreach ($idp_raw_list as $idp_line) {
175 $idp_data = explode(
',', $idp_line);
176 if (isset($idp_data[2])) {
177 $idp_list[trim($idp_data[0])] = [trim($idp_data[1]), trim($idp_data[2])];
178 } elseif (isset($idp_data[1])) {
179 $idp_list[trim($idp_data[0])] = [trim($idp_data[1])];
192 if (
null === $value) {
195 $arr_cookie = explode(
' ', $value);
196 return array_map(
'base64_decode', $arr_cookie);
204 $arr_cookie = array_map(
'base64_encode', $arr_cookie);
205 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);
setSAMLCookie()
@description Sets the standard SAML domain cookie that is also used to preselect the right entry on t...
generateCookieArray(?string $value)
@description Generates an array of IDPs using the cookie value
redirect()
@description Redirects user to the local Shibboleth session initatiotor with already set GET argument...
const COOKIE_NAME_SAML_IDP
showNotice()
@description Show notice in case no IdP was selected
getIdplist()
@description Generate array of IdPs from ILIAS Shibboleth settings
generateCookieValue(array $arr_cookie)
@description Generate the value that is stored in the cookie using the list of IDPs
appendCookieValue(string $value, array $arr_cookie)
@description Append a value to the array of IDPs
static redirect(string $a_script)