ILIAS  Release_4_4_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ShibWAYF Class Reference

Class ShibbolethWAYF. More...

+ Collaboration diagram for ShibWAYF:

Public Member Functions

 __construct ()
 is_selection ()
 isSelection ()
 is_valid_selection ()
 isValidSelection ()
 generateSelection ()
 redirect ()
 Redirects user to the local Shibboleth session initatiotor with already set GET arguments for the right IdP and return location.
 setSAMLCookie ()
 Sets the standard SAML domain cookie that is also used to preselect the right entry on the local wayf
 showNotice ()
 getIdplist ()
 generateCookieArray ($value)
 generateCookieValue (array $arr_cookie)
 appendCookieValue ($value, array $arr_cookie)

Data Fields

 $is_selection = false
 $is_valid_selection = false
 $selected_idp = '-'
 $idp_list = false

Detailed Description

Class ShibbolethWAYF.

This class handles the Home Organization selection (also called Where Are You From service) process for Shibboleth users.

Author
Fabian Schmid fs@st.nosp@m.uder.nosp@m.-raim.nosp@m.ann..nosp@m.ch

Definition at line 34 of file class.ilShibbolethWAYF.php.

Constructor & Destructor Documentation

ShibWAYF::__construct ( )

Definition at line 54 of file class.ilShibbolethWAYF.php.

References $_POST, getIdplist(), is_selection(), and is_valid_selection().

{
// Was the WAYF form submitted?
if (isset($_POST['home_organization_selection'])) {
$this->is_selection = true;
} else {
$this->is_selection = false;
}
// Was selected IdP a valid
$this->idp_list = $this->getIdplist();
if (isset($_POST['idp_selection']) AND
$_POST['idp_selection'] != '-' AND isset($this->idp_list[$_POST['idp_selection']])
) {
$this->is_valid_selection = true;
$this->selected_idp = $_POST['idp_selection'];
} else {
$this->is_valid_selection = false;
}
}

+ Here is the call graph for this function:

Member Function Documentation

ShibWAYF::appendCookieValue (   $value,
array  $arr_cookie 
)
Parameters
$value
$arr_cookieAppend a value to the array of IDPs
Returns
array

Definition at line 252 of file class.ilShibbolethWAYF.php.

Referenced by setSAMLCookie().

{
array_push($arr_cookie, $value);
$arr_cookie = array_reverse($arr_cookie);
$arr_cookie = array_unique($arr_cookie);
$arr_cookie = array_reverse($arr_cookie);
return $arr_cookie;
}

+ Here is the caller graph for this function:

ShibWAYF::generateCookieArray (   $value)
Parameters
$valueGenerates an array of IDPs using the cookie value
Returns
array

Definition at line 221 of file class.ilShibbolethWAYF.php.

Referenced by generateSelection(), and setSAMLCookie().

{
$arr_cookie = explode(' ', $value);
$arr_cookie = array_map('base64_decode', $arr_cookie);
return $arr_cookie;
}

+ Here is the caller graph for this function:

ShibWAYF::generateCookieValue ( array  $arr_cookie)
Parameters
$arr_cookieGenerate the value that is stored in the cookie using the list of IDPs
Returns
string

Definition at line 236 of file class.ilShibbolethWAYF.php.

Referenced by setSAMLCookie().

{
$arr_cookie = array_map('base64_encode', $arr_cookie);
$value = implode(' ', $arr_cookie);
return $value;
}

+ Here is the caller graph for this function:

ShibWAYF::generateSelection ( )
Returns
string

Definition at line 109 of file class.ilShibbolethWAYF.php.

References $_COOKIE, $_GET, $idp_list, $lng, generateCookieArray(), and getIdplist().

{
if (! $this->idp_list) {
$arr_idp_list = $this->getIdplist();
} else {
$arr_idp_list = $this->idp_list;
}
$idp_cookie = $this->generateCookieArray($_COOKIE['_saml_idp']);
$lng = new ilLanguage($_GET["lang"]);
if (count($idp_cookie) > 0 AND isset($arr_idp_list[end($idp_cookie)])) {
$selectedIDP = end($idp_cookie);
$selectElement = '
<select name="idp_selection">
<option value="-">' . $lng->txt("shib_member_of") . '</option>';
} else {
$selectElement = '
<select name="idp_selection">
<option value="-" selected="selected">' . $lng->txt("shib_member_of") . '</option>';
}
foreach ($arr_idp_list as $idp_id => $idp_data) {
if ($idp_id == $selectedIDP) {
$selectElement .= '<option value="' . $idp_id . '" selected="selected">' . $idp_data[0] . '</option>';
} else {
$selectElement .= '<option value="' . $idp_id . '">' . $idp_data[0] . '</option>';
}
}
$selectElement .= '
</select>';
return $selectElement;
}

+ Here is the call graph for this function:

ShibWAYF::getIdplist ( )
Returns
array Generate array of IdPs from ILIAS Shibboleth settings

Definition at line 197 of file class.ilShibbolethWAYF.php.

References $idp_list, and $ilSetting.

Referenced by __construct(), generateSelection(), and redirect().

{
global $ilSetting;
$idp_list = array();
$idp_raw_list = split("\n", $ilSetting->get("shib_idp_list"));
foreach ($idp_raw_list as $idp_line) {
$idp_data = split(',', $idp_line);
if (isset($idp_data[2])) {
$idp_list[trim($idp_data[0])] = array( trim($idp_data[1]), trim($idp_data[2]) );
} elseif (isset($idp_data[1])) {
$idp_list[trim($idp_data[0])] = array( trim($idp_data[1]) );
}
}
return $idp_list;
}

+ Here is the caller graph for this function:

ShibWAYF::is_selection ( )
Returns
bool

Definition at line 77 of file class.ilShibbolethWAYF.php.

References isSelection().

Referenced by __construct(), and showNotice().

{
return $this->isSelection();
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ShibWAYF::is_valid_selection ( )
Returns
bool

Definition at line 93 of file class.ilShibbolethWAYF.php.

References isValidSelection().

Referenced by __construct(), and showNotice().

{
return $this->isValidSelection();
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ShibWAYF::isSelection ( )
Returns
bool

Definition at line 85 of file class.ilShibbolethWAYF.php.

References $is_selection.

Referenced by is_selection().

{
}

+ Here is the caller graph for this function:

ShibWAYF::isValidSelection ( )
Returns
bool

Definition at line 101 of file class.ilShibbolethWAYF.php.

References $is_valid_selection.

Referenced by is_valid_selection().

+ Here is the caller graph for this function:

ShibWAYF::redirect ( )

Redirects user to the local Shibboleth session initatiotor with already set GET arguments for the right IdP and return location.

Definition at line 144 of file class.ilShibbolethWAYF.php.

References $_POST, $idp_list, $selected_idp, and getIdplist().

{
if (! $this->idp_list) {
$arr_idp_list = $this->getIdplist();
} else {
$arr_idp_list = $this->idp_list;
}
// Where to return after the authentication process
$target = trim(ILIAS_HTTP_PATH, '/') . '/shib_login.php?target=' . $_POST["il_target"];
$idp_data = $arr_idp_list[$this->selected_idp];
if (isset($idp_data[1])) {
ilUtil::redirect($idp_data[1] . '?providerId=' . urlencode($this->selected_idp) . '&target='
. urlencode($target));
} else {
// TODO: This has to be changed to /Shibboleth.sso/DS?entityId= for
// Shibbolet 2.x sometime...
ilUtil::redirect('/Shibboleth.sso?providerId=' . urlencode($this->selected_idp) . '&target='
. urlencode($target));
}
}

+ Here is the call graph for this function:

ShibWAYF::setSAMLCookie ( )

Sets the standard SAML domain cookie that is also used to preselect the right entry on the local wayf

Definition at line 168 of file class.ilShibbolethWAYF.php.

References $_COOKIE, appendCookieValue(), generateCookieArray(), and generateCookieValue().

{
if (isset($_COOKIE['_saml_idp'])) {
$arr_idps = $this->generateCookieArray($_COOKIE['_saml_idp']);
} else {
$arr_idps = array();
}
$arr_idps = $this->appendCookieValue($this->selected_idp, $arr_idps);
setcookie('_saml_idp', $this->generateCookieValue($arr_idps), time() + (100 * 24 * 3600), '/');
}

+ Here is the call graph for this function:

ShibWAYF::showNotice ( )
Returns
string Show notice in case no IdP was selected

Definition at line 183 of file class.ilShibbolethWAYF.php.

References $_GET, $lng, is_selection(), and is_valid_selection().

{
$lng = new ilLanguage($_GET["lang"]);
if (! $this->is_selection() or $this->is_valid_selection()) {
return '';
} else {
return $lng->txt("shib_invalid_home_organization");
}
}

+ Here is the call graph for this function:

Field Documentation

ShibWAYF::$idp_list = false

Definition at line 51 of file class.ilShibbolethWAYF.php.

Referenced by generateSelection(), getIdplist(), and redirect().

ShibWAYF::$is_selection = false

Definition at line 39 of file class.ilShibbolethWAYF.php.

Referenced by isSelection().

ShibWAYF::$is_valid_selection = false

Definition at line 43 of file class.ilShibbolethWAYF.php.

Referenced by isValidSelection().

ShibWAYF::$selected_idp = '-'

Definition at line 47 of file class.ilShibbolethWAYF.php.

Referenced by redirect().


The documentation for this class was generated from the following file: